Update CI references to 0.0.122
[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 LDKBlindedFailure LDKBlindedFailure_from_js(int32_t ord) {
154         switch (ord) {
155                 case 0: return LDKBlindedFailure_FromIntroductionNode;
156                 case 1: return LDKBlindedFailure_FromBlindedNode;
157         }
158         abort();
159 }
160 static inline int32_t LDKBlindedFailure_to_js(LDKBlindedFailure val) {
161         switch (val) {
162                 case LDKBlindedFailure_FromIntroductionNode: return 0;
163                 case LDKBlindedFailure_FromBlindedNode: return 1;
164                 default: abort();
165         }
166 }
167 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
168         switch (ord) {
169                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
170                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
171                 case 2: return LDKBolt11SemanticError_NoDescription;
172                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
173                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
174                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
175                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
176                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
177                 case 8: return LDKBolt11SemanticError_InvalidSignature;
178                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
179         }
180         abort();
181 }
182 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
183         switch (val) {
184                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
185                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
186                 case LDKBolt11SemanticError_NoDescription: return 2;
187                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
188                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
189                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
190                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
191                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
192                 case LDKBolt11SemanticError_InvalidSignature: return 8;
193                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
194                 default: abort();
195         }
196 }
197 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
198         switch (ord) {
199                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
200                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
201                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
202                 case 3: return LDKBolt12SemanticError_MissingAmount;
203                 case 4: return LDKBolt12SemanticError_InvalidAmount;
204                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
205                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
206                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
207                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
208                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
209                 case 10: return LDKBolt12SemanticError_MissingDescription;
210                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
211                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
212                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
213                 case 14: return LDKBolt12SemanticError_MissingQuantity;
214                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
215                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
216                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
217                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
218                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
219                 case 20: return LDKBolt12SemanticError_MissingPayerId;
220                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
221                 case 22: return LDKBolt12SemanticError_MissingPaths;
222                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
223                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
224                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
225                 case 26: return LDKBolt12SemanticError_MissingSignature;
226         }
227         abort();
228 }
229 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
230         switch (val) {
231                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
232                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
233                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
234                 case LDKBolt12SemanticError_MissingAmount: return 3;
235                 case LDKBolt12SemanticError_InvalidAmount: return 4;
236                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
237                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
238                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
239                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
240                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
241                 case LDKBolt12SemanticError_MissingDescription: return 10;
242                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
243                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
244                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
245                 case LDKBolt12SemanticError_MissingQuantity: return 14;
246                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
247                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
248                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
249                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
250                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
251                 case LDKBolt12SemanticError_MissingPayerId: return 20;
252                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
253                 case LDKBolt12SemanticError_MissingPaths: return 22;
254                 case LDKBolt12SemanticError_InvalidPayInfo: return 23;
255                 case LDKBolt12SemanticError_MissingCreationTime: return 24;
256                 case LDKBolt12SemanticError_MissingPaymentHash: return 25;
257                 case LDKBolt12SemanticError_MissingSignature: return 26;
258                 default: abort();
259         }
260 }
261 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
262         switch (ord) {
263                 case 0: return LDKCOption_NoneZ_Some;
264                 case 1: return LDKCOption_NoneZ_None;
265         }
266         abort();
267 }
268 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
269         switch (val) {
270                 case LDKCOption_NoneZ_Some: return 0;
271                 case LDKCOption_NoneZ_None: return 1;
272                 default: abort();
273         }
274 }
275 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
276         switch (ord) {
277                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
278                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
279                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
280         }
281         abort();
282 }
283 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
284         switch (val) {
285                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
286                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
287                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
288                 default: abort();
289         }
290 }
291 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
292         switch (ord) {
293                 case 0: return LDKChannelShutdownState_NotShuttingDown;
294                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
295                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
296                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
297                 case 4: return LDKChannelShutdownState_ShutdownComplete;
298         }
299         abort();
300 }
301 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
302         switch (val) {
303                 case LDKChannelShutdownState_NotShuttingDown: return 0;
304                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
305                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
306                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
307                 case LDKChannelShutdownState_ShutdownComplete: return 4;
308                 default: abort();
309         }
310 }
311 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
312         switch (ord) {
313                 case 0: return LDKConfirmationTarget_OnChainSweep;
314                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
315                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
316                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
317                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
318                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
319         }
320         abort();
321 }
322 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
323         switch (val) {
324                 case LDKConfirmationTarget_OnChainSweep: return 0;
325                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
326                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
327                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
328                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
329                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
330                 default: abort();
331         }
332 }
333 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
334         switch (ord) {
335                 case 0: return LDKCreationError_DescriptionTooLong;
336                 case 1: return LDKCreationError_RouteTooLong;
337                 case 2: return LDKCreationError_TimestampOutOfBounds;
338                 case 3: return LDKCreationError_InvalidAmount;
339                 case 4: return LDKCreationError_MissingRouteHints;
340                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
341         }
342         abort();
343 }
344 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
345         switch (val) {
346                 case LDKCreationError_DescriptionTooLong: return 0;
347                 case LDKCreationError_RouteTooLong: return 1;
348                 case LDKCreationError_TimestampOutOfBounds: return 2;
349                 case LDKCreationError_InvalidAmount: return 3;
350                 case LDKCreationError_MissingRouteHints: return 4;
351                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
352                 default: abort();
353         }
354 }
355 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
356         switch (ord) {
357                 case 0: return LDKCurrency_Bitcoin;
358                 case 1: return LDKCurrency_BitcoinTestnet;
359                 case 2: return LDKCurrency_Regtest;
360                 case 3: return LDKCurrency_Simnet;
361                 case 4: return LDKCurrency_Signet;
362         }
363         abort();
364 }
365 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
366         switch (val) {
367                 case LDKCurrency_Bitcoin: return 0;
368                 case LDKCurrency_BitcoinTestnet: return 1;
369                 case LDKCurrency_Regtest: return 2;
370                 case LDKCurrency_Simnet: return 3;
371                 case LDKCurrency_Signet: return 4;
372                 default: abort();
373         }
374 }
375 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
376         switch (ord) {
377                 case 0: return LDKHTLCClaim_OfferedTimeout;
378                 case 1: return LDKHTLCClaim_OfferedPreimage;
379                 case 2: return LDKHTLCClaim_AcceptedTimeout;
380                 case 3: return LDKHTLCClaim_AcceptedPreimage;
381                 case 4: return LDKHTLCClaim_Revocation;
382         }
383         abort();
384 }
385 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
386         switch (val) {
387                 case LDKHTLCClaim_OfferedTimeout: return 0;
388                 case LDKHTLCClaim_OfferedPreimage: return 1;
389                 case LDKHTLCClaim_AcceptedTimeout: return 2;
390                 case LDKHTLCClaim_AcceptedPreimage: return 3;
391                 case LDKHTLCClaim_Revocation: return 4;
392                 default: abort();
393         }
394 }
395 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
396         switch (ord) {
397                 case 0: return LDKIOError_NotFound;
398                 case 1: return LDKIOError_PermissionDenied;
399                 case 2: return LDKIOError_ConnectionRefused;
400                 case 3: return LDKIOError_ConnectionReset;
401                 case 4: return LDKIOError_ConnectionAborted;
402                 case 5: return LDKIOError_NotConnected;
403                 case 6: return LDKIOError_AddrInUse;
404                 case 7: return LDKIOError_AddrNotAvailable;
405                 case 8: return LDKIOError_BrokenPipe;
406                 case 9: return LDKIOError_AlreadyExists;
407                 case 10: return LDKIOError_WouldBlock;
408                 case 11: return LDKIOError_InvalidInput;
409                 case 12: return LDKIOError_InvalidData;
410                 case 13: return LDKIOError_TimedOut;
411                 case 14: return LDKIOError_WriteZero;
412                 case 15: return LDKIOError_Interrupted;
413                 case 16: return LDKIOError_Other;
414                 case 17: return LDKIOError_UnexpectedEof;
415         }
416         abort();
417 }
418 static inline int32_t LDKIOError_to_js(LDKIOError val) {
419         switch (val) {
420                 case LDKIOError_NotFound: return 0;
421                 case LDKIOError_PermissionDenied: return 1;
422                 case LDKIOError_ConnectionRefused: return 2;
423                 case LDKIOError_ConnectionReset: return 3;
424                 case LDKIOError_ConnectionAborted: return 4;
425                 case LDKIOError_NotConnected: return 5;
426                 case LDKIOError_AddrInUse: return 6;
427                 case LDKIOError_AddrNotAvailable: return 7;
428                 case LDKIOError_BrokenPipe: return 8;
429                 case LDKIOError_AlreadyExists: return 9;
430                 case LDKIOError_WouldBlock: return 10;
431                 case LDKIOError_InvalidInput: return 11;
432                 case LDKIOError_InvalidData: return 12;
433                 case LDKIOError_TimedOut: return 13;
434                 case LDKIOError_WriteZero: return 14;
435                 case LDKIOError_Interrupted: return 15;
436                 case LDKIOError_Other: return 16;
437                 case LDKIOError_UnexpectedEof: return 17;
438                 default: abort();
439         }
440 }
441 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
442         switch (ord) {
443                 case 0: return LDKLevel_Gossip;
444                 case 1: return LDKLevel_Trace;
445                 case 2: return LDKLevel_Debug;
446                 case 3: return LDKLevel_Info;
447                 case 4: return LDKLevel_Warn;
448                 case 5: return LDKLevel_Error;
449         }
450         abort();
451 }
452 static inline int32_t LDKLevel_to_js(LDKLevel val) {
453         switch (val) {
454                 case LDKLevel_Gossip: return 0;
455                 case LDKLevel_Trace: return 1;
456                 case LDKLevel_Debug: return 2;
457                 case LDKLevel_Info: return 3;
458                 case LDKLevel_Warn: return 4;
459                 case LDKLevel_Error: return 5;
460                 default: abort();
461         }
462 }
463 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
464         switch (ord) {
465                 case 0: return LDKNetwork_Bitcoin;
466                 case 1: return LDKNetwork_Testnet;
467                 case 2: return LDKNetwork_Regtest;
468                 case 3: return LDKNetwork_Signet;
469         }
470         abort();
471 }
472 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
473         switch (val) {
474                 case LDKNetwork_Bitcoin: return 0;
475                 case LDKNetwork_Testnet: return 1;
476                 case LDKNetwork_Regtest: return 2;
477                 case LDKNetwork_Signet: return 3;
478                 default: abort();
479         }
480 }
481 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
482         switch (ord) {
483                 case 0: return LDKPaymentFailureReason_RecipientRejected;
484                 case 1: return LDKPaymentFailureReason_UserAbandoned;
485                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
486                 case 3: return LDKPaymentFailureReason_PaymentExpired;
487                 case 4: return LDKPaymentFailureReason_RouteNotFound;
488                 case 5: return LDKPaymentFailureReason_UnexpectedError;
489         }
490         abort();
491 }
492 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
493         switch (val) {
494                 case LDKPaymentFailureReason_RecipientRejected: return 0;
495                 case LDKPaymentFailureReason_UserAbandoned: return 1;
496                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
497                 case LDKPaymentFailureReason_PaymentExpired: return 3;
498                 case LDKPaymentFailureReason_RouteNotFound: return 4;
499                 case LDKPaymentFailureReason_UnexpectedError: return 5;
500                 default: abort();
501         }
502 }
503 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
504         switch (ord) {
505                 case 0: return LDKRecipient_Node;
506                 case 1: return LDKRecipient_PhantomNode;
507         }
508         abort();
509 }
510 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
511         switch (val) {
512                 case LDKRecipient_Node: return 0;
513                 case LDKRecipient_PhantomNode: return 1;
514                 default: abort();
515         }
516 }
517 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
518         switch (ord) {
519                 case 0: return LDKRetryableSendFailure_PaymentExpired;
520                 case 1: return LDKRetryableSendFailure_RouteNotFound;
521                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
522         }
523         abort();
524 }
525 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
526         switch (val) {
527                 case LDKRetryableSendFailure_PaymentExpired: return 0;
528                 case LDKRetryableSendFailure_RouteNotFound: return 1;
529                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
530                 default: abort();
531         }
532 }
533 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
534         switch (ord) {
535                 case 0: return LDKSecp256k1Error_IncorrectSignature;
536                 case 1: return LDKSecp256k1Error_InvalidMessage;
537                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
538                 case 3: return LDKSecp256k1Error_InvalidSignature;
539                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
540                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
541                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
542                 case 7: return LDKSecp256k1Error_InvalidTweak;
543                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
544                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
545                 case 10: return LDKSecp256k1Error_InvalidParityValue;
546         }
547         abort();
548 }
549 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
550         switch (val) {
551                 case LDKSecp256k1Error_IncorrectSignature: return 0;
552                 case LDKSecp256k1Error_InvalidMessage: return 1;
553                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
554                 case LDKSecp256k1Error_InvalidSignature: return 3;
555                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
556                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
557                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
558                 case LDKSecp256k1Error_InvalidTweak: return 7;
559                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
560                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
561                 case LDKSecp256k1Error_InvalidParityValue: return 10;
562                 default: abort();
563         }
564 }
565 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
566         switch (ord) {
567                 case 0: return LDKSiPrefix_Milli;
568                 case 1: return LDKSiPrefix_Micro;
569                 case 2: return LDKSiPrefix_Nano;
570                 case 3: return LDKSiPrefix_Pico;
571         }
572         abort();
573 }
574 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
575         switch (val) {
576                 case LDKSiPrefix_Milli: return 0;
577                 case LDKSiPrefix_Micro: return 1;
578                 case LDKSiPrefix_Nano: return 2;
579                 case LDKSiPrefix_Pico: return 3;
580                 default: abort();
581         }
582 }
583 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
584         switch (ord) {
585                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
586                 case 1: return LDKSocketAddressParseError_InvalidInput;
587                 case 2: return LDKSocketAddressParseError_InvalidPort;
588                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
589         }
590         abort();
591 }
592 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
593         switch (val) {
594                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
595                 case LDKSocketAddressParseError_InvalidInput: return 1;
596                 case LDKSocketAddressParseError_InvalidPort: return 2;
597                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
598                 default: abort();
599         }
600 }
601 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
602         switch (ord) {
603                 case 0: return LDKUtxoLookupError_UnknownChain;
604                 case 1: return LDKUtxoLookupError_UnknownTx;
605         }
606         abort();
607 }
608 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
609         switch (val) {
610                 case LDKUtxoLookupError_UnknownChain: return 0;
611                 case LDKUtxoLookupError_UnknownTx: return 1;
612                 default: abort();
613         }
614 }
615 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
616         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
617         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
618         return ret;
619 }
620 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
621         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
622         return ret;
623 }
624 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
625         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
626         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
627         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
628         return ret_arr;
629 }
630
631 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
632 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
633         if (!ptr_is_owned(thing)) return;
634         void* thing_ptr = untag_ptr(thing);
635         CHECK_ACCESS(thing_ptr);
636         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
637         FREE(untag_ptr(thing));
638         BigEndianScalar_free(thing_conv);
639 }
640
641 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
642         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
643         switch(obj->tag) {
644                 case LDKBech32Error_MissingSeparator: return 0;
645                 case LDKBech32Error_InvalidChecksum: return 1;
646                 case LDKBech32Error_InvalidLength: return 2;
647                 case LDKBech32Error_InvalidChar: return 3;
648                 case LDKBech32Error_InvalidData: return 4;
649                 case LDKBech32Error_InvalidPadding: return 5;
650                 case LDKBech32Error_MixedCase: return 6;
651                 default: abort();
652         }
653 }
654 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
655         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
656         assert(obj->tag == LDKBech32Error_InvalidChar);
657         int32_t invalid_char_conv = obj->invalid_char;
658         return invalid_char_conv;
659 }
660 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
661         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
662         assert(obj->tag == LDKBech32Error_InvalidData);
663         int8_t invalid_data_conv = obj->invalid_data;
664         return invalid_data_conv;
665 }
666 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
667         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
668         switch(obj->tag) {
669                 case LDKCOption_u64Z_Some: return 0;
670                 case LDKCOption_u64Z_None: return 1;
671                 default: abort();
672         }
673 }
674 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
675         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
676         assert(obj->tag == LDKCOption_u64Z_Some);
677         int64_t some_conv = obj->some;
678         return some_conv;
679 }
680 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
681         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
682         for (size_t i = 0; i < ret.datalen; i++) {
683                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
684         }
685         return ret;
686 }
687 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
688         LDKRefund ret = *owner->contents.result;
689         ret.is_owned = false;
690         return ret;
691 }
692 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
693         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
694         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
695         uint64_t ret_ref = 0;
696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
698         return ret_ref;
699 }
700
701 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
702         LDKBolt12ParseError ret = *owner->contents.err;
703         ret.is_owned = false;
704         return ret;
705 }
706 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
707         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
708         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
709         uint64_t ret_ref = 0;
710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
712         return ret_ref;
713 }
714
715 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
716         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
717         switch(obj->tag) {
718                 case LDKRetry_Attempts: return 0;
719                 default: abort();
720         }
721 }
722 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
723         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
724         assert(obj->tag == LDKRetry_Attempts);
725         int32_t attempts_conv = obj->attempts;
726         return attempts_conv;
727 }
728 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
729         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
730         switch(obj->tag) {
731                 case LDKDecodeError_UnknownVersion: return 0;
732                 case LDKDecodeError_UnknownRequiredFeature: return 1;
733                 case LDKDecodeError_InvalidValue: return 2;
734                 case LDKDecodeError_ShortRead: return 3;
735                 case LDKDecodeError_BadLengthDescriptor: return 4;
736                 case LDKDecodeError_Io: return 5;
737                 case LDKDecodeError_UnsupportedCompression: return 6;
738                 default: abort();
739         }
740 }
741 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
742         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
743         assert(obj->tag == LDKDecodeError_Io);
744         uint32_t io_conv = LDKIOError_to_js(obj->io);
745         return io_conv;
746 }
747 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
748 CHECK(owner->result_ok);
749         return Retry_clone(&*owner->contents.result);
750 }
751 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
752         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
753         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
754         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
755         uint64_t ret_ref = tag_ptr(ret_copy, true);
756         return ret_ref;
757 }
758
759 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
760 CHECK(!owner->result_ok);
761         return DecodeError_clone(&*owner->contents.err);
762 }
763 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
764         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
766         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
767         uint64_t ret_ref = tag_ptr(ret_copy, true);
768         return ret_ref;
769 }
770
771 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
772         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
773         switch(obj->tag) {
774                 case LDKAPIError_APIMisuseError: return 0;
775                 case LDKAPIError_FeeRateTooHigh: return 1;
776                 case LDKAPIError_InvalidRoute: return 2;
777                 case LDKAPIError_ChannelUnavailable: return 3;
778                 case LDKAPIError_MonitorUpdateInProgress: return 4;
779                 case LDKAPIError_IncompatibleShutdownScript: return 5;
780                 default: abort();
781         }
782 }
783 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
784         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
785         assert(obj->tag == LDKAPIError_APIMisuseError);
786         LDKStr err_str = obj->api_misuse_error.err;
787                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
788         return err_conv;
789 }
790 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
791         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
792         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
793         LDKStr err_str = obj->fee_rate_too_high.err;
794                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
795         return err_conv;
796 }
797 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
798         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
799         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
800         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
801         return feerate_conv;
802 }
803 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
804         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
805         assert(obj->tag == LDKAPIError_InvalidRoute);
806         LDKStr err_str = obj->invalid_route.err;
807                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
808         return err_conv;
809 }
810 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
811         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
812         assert(obj->tag == LDKAPIError_ChannelUnavailable);
813         LDKStr err_str = obj->channel_unavailable.err;
814                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
815         return err_conv;
816 }
817 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
818         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
819         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
820         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
821                         uint64_t script_ref = 0;
822                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
823                         script_ref = tag_ptr(script_var.inner, false);
824         return script_ref;
825 }
826 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
827 CHECK(owner->result_ok);
828         return *owner->contents.result;
829 }
830 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
831         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
832         CResult_NoneAPIErrorZ_get_ok(owner_conv);
833 }
834
835 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
836 CHECK(!owner->result_ok);
837         return APIError_clone(&*owner->contents.err);
838 }
839 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
840         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
841         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
842         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
843         uint64_t ret_ref = tag_ptr(ret_copy, true);
844         return ret_ref;
845 }
846
847 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
848         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
849         for (size_t i = 0; i < ret.datalen; i++) {
850                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
851         }
852         return ret;
853 }
854 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
855         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
856         for (size_t i = 0; i < ret.datalen; i++) {
857                 ret.data[i] = APIError_clone(&orig->data[i]);
858         }
859         return ret;
860 }
861 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
862         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
863         switch(obj->tag) {
864                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
865                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
866                 default: abort();
867         }
868 }
869 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
870         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
871         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
872         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
873         memcpy(some_arr->elems, obj->some.data, 32);
874         return some_arr;
875 }
876 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
877         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
878         switch(obj->tag) {
879                 case LDKCOption_CVec_u8ZZ_Some: return 0;
880                 case LDKCOption_CVec_u8ZZ_None: return 1;
881                 default: abort();
882         }
883 }
884 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
885         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
886         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
887         LDKCVec_u8Z some_var = obj->some;
888                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
889                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
890         return some_arr;
891 }
892 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
893         LDKRecipientOnionFields ret = *owner->contents.result;
894         ret.is_owned = false;
895         return ret;
896 }
897 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
898         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
899         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
900         uint64_t ret_ref = 0;
901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
903         return ret_ref;
904 }
905
906 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
907 CHECK(!owner->result_ok);
908         return DecodeError_clone(&*owner->contents.err);
909 }
910 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
911         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
913         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
914         uint64_t ret_ref = tag_ptr(ret_copy, true);
915         return ret_ref;
916 }
917
918 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
919         return owner->a;
920 }
921 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
922         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
923         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
924         return ret_conv;
925 }
926
927 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
928         return CVec_u8Z_clone(&owner->b);
929 }
930 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
931         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
932         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
933         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
934         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
935         CVec_u8Z_free(ret_var);
936         return ret_arr;
937 }
938
939 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
940         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
941         for (size_t i = 0; i < ret.datalen; i++) {
942                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
943         }
944         return ret;
945 }
946 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
947         LDKRecipientOnionFields ret = *owner->contents.result;
948         ret.is_owned = false;
949         return ret;
950 }
951 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
952         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
953         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
954         uint64_t ret_ref = 0;
955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
957         return ret_ref;
958 }
959
960 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
961 CHECK(!owner->result_ok);
962         return *owner->contents.err;
963 }
964 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
965         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
966         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
967 }
968
969 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
970         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
971         for (size_t i = 0; i < ret.datalen; i++) {
972                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
973         }
974         return ret;
975 }
976 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
977         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
978         switch(obj->tag) {
979                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
980                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
981                 default: abort();
982         }
983 }
984 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
985         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
986         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
987         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
988                         ptrArray some_arr = NULL;
989                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
990                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
991                         for (size_t m = 0; m < some_var.datalen; m++) {
992                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
993                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
994                                 some_arr_ptr[m] = some_conv_12_arr;
995                         }
996                         
997         return some_arr;
998 }
999 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1000 CHECK(owner->result_ok);
1001         return ThirtyTwoBytes_clone(&*owner->contents.result);
1002 }
1003 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1004         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1005         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1006         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1007         return ret_arr;
1008 }
1009
1010 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1011 CHECK(!owner->result_ok);
1012         return *owner->contents.err;
1013 }
1014 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1015         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1016         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1017 }
1018
1019 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1020         LDKBlindedPayInfo ret = *owner->contents.result;
1021         ret.is_owned = false;
1022         return ret;
1023 }
1024 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1025         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1026         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1027         uint64_t ret_ref = 0;
1028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1030         return ret_ref;
1031 }
1032
1033 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1034 CHECK(!owner->result_ok);
1035         return DecodeError_clone(&*owner->contents.err);
1036 }
1037 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1038         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1040         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1041         uint64_t ret_ref = tag_ptr(ret_copy, true);
1042         return ret_ref;
1043 }
1044
1045 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1046         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1047         ret.is_owned = false;
1048         return ret;
1049 }
1050 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1051         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1052         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1053         uint64_t ret_ref = 0;
1054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1056         return ret_ref;
1057 }
1058
1059 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1060 CHECK(!owner->result_ok);
1061         return DecodeError_clone(&*owner->contents.err);
1062 }
1063 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1064         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1065         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1066         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1067         uint64_t ret_ref = tag_ptr(ret_copy, true);
1068         return ret_ref;
1069 }
1070
1071 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1072         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1073         ret.is_owned = false;
1074         return ret;
1075 }
1076 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1077         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1078         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1079         uint64_t ret_ref = 0;
1080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1082         return ret_ref;
1083 }
1084
1085 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1086 CHECK(!owner->result_ok);
1087         return DecodeError_clone(&*owner->contents.err);
1088 }
1089 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1090         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1092         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1093         uint64_t ret_ref = tag_ptr(ret_copy, true);
1094         return ret_ref;
1095 }
1096
1097 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1098         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1099         switch(obj->tag) {
1100                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1101                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1102                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1103                 default: abort();
1104         }
1105 }
1106 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1107         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1108         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1109         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1110                         uint64_t outpoint_ref = 0;
1111                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1112                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1113         return outpoint_ref;
1114 }
1115 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1116         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1117         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1118         LDKTxOut* output_ref = &obj->static_output.output;
1119         return tag_ptr(output_ref, false);
1120 }
1121 int8_tArray __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(uint64_t ptr) {
1122         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1123         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1124         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1125         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1126         return channel_keys_id_arr;
1127 }
1128 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1129         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1130         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1131         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1132                         uint64_t delayed_payment_output_ref = 0;
1133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1134                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1135         return delayed_payment_output_ref;
1136 }
1137 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1138         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1139         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1140         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1141                         uint64_t static_payment_output_ref = 0;
1142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1143                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1144         return static_payment_output_ref;
1145 }
1146 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1147 CHECK(owner->result_ok);
1148         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1149 }
1150 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1151         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1152         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1153         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1154         uint64_t ret_ref = tag_ptr(ret_copy, true);
1155         return ret_ref;
1156 }
1157
1158 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1159 CHECK(!owner->result_ok);
1160         return DecodeError_clone(&*owner->contents.err);
1161 }
1162 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1163         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1165         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1166         uint64_t ret_ref = tag_ptr(ret_copy, true);
1167         return ret_ref;
1168 }
1169
1170 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1171         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1172         for (size_t i = 0; i < ret.datalen; i++) {
1173                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1174         }
1175         return ret;
1176 }
1177 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1178         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1179         for (size_t i = 0; i < ret.datalen; i++) {
1180                 ret.data[i] = TxOut_clone(&orig->data[i]);
1181         }
1182         return ret;
1183 }
1184 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1185         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1186         switch(obj->tag) {
1187                 case LDKCOption_u32Z_Some: return 0;
1188                 case LDKCOption_u32Z_None: return 1;
1189                 default: abort();
1190         }
1191 }
1192 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1193         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1194         assert(obj->tag == LDKCOption_u32Z_Some);
1195         int32_t some_conv = obj->some;
1196         return some_conv;
1197 }
1198 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1199         return CVec_u8Z_clone(&owner->a);
1200 }
1201 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_a"))) TS_C2Tuple_CVec_u8Zu64Z_get_a(uint64_t owner) {
1202         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1203         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1204         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1205         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1206         CVec_u8Z_free(ret_var);
1207         return ret_arr;
1208 }
1209
1210 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1211         return owner->b;
1212 }
1213 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_b"))) TS_C2Tuple_CVec_u8Zu64Z_get_b(uint64_t owner) {
1214         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1215         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1216         return ret_conv;
1217 }
1218
1219 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1220 CHECK(owner->result_ok);
1221         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1222 }
1223 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(uint64_t owner) {
1224         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1225         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1226         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1227         return tag_ptr(ret_conv, true);
1228 }
1229
1230 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1231 CHECK(!owner->result_ok);
1232         return *owner->contents.err;
1233 }
1234 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(uint64_t owner) {
1235         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1236         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1237 }
1238
1239 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1240         LDKChannelDerivationParameters ret = *owner->contents.result;
1241         ret.is_owned = false;
1242         return ret;
1243 }
1244 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1245         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1246         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1247         uint64_t ret_ref = 0;
1248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1250         return ret_ref;
1251 }
1252
1253 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1254 CHECK(!owner->result_ok);
1255         return DecodeError_clone(&*owner->contents.err);
1256 }
1257 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1258         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1260         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1261         uint64_t ret_ref = tag_ptr(ret_copy, true);
1262         return ret_ref;
1263 }
1264
1265 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1266         LDKHTLCDescriptor ret = *owner->contents.result;
1267         ret.is_owned = false;
1268         return ret;
1269 }
1270 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1271         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1272         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1273         uint64_t ret_ref = 0;
1274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1276         return ret_ref;
1277 }
1278
1279 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1280 CHECK(!owner->result_ok);
1281         return DecodeError_clone(&*owner->contents.err);
1282 }
1283 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1284         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1286         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1287         uint64_t ret_ref = tag_ptr(ret_copy, true);
1288         return ret_ref;
1289 }
1290
1291 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1292 CHECK(owner->result_ok);
1293         return *owner->contents.result;
1294 }
1295 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1296         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1297         CResult_NoneNoneZ_get_ok(owner_conv);
1298 }
1299
1300 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1301 CHECK(!owner->result_ok);
1302         return *owner->contents.err;
1303 }
1304 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1305         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1306         CResult_NoneNoneZ_get_err(owner_conv);
1307 }
1308
1309 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1310 CHECK(owner->result_ok);
1311         return *owner->contents.result;
1312 }
1313 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1314         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1315         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1316         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1317         return ret_arr;
1318 }
1319
1320 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1321 CHECK(!owner->result_ok);
1322         return *owner->contents.err;
1323 }
1324 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1325         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1326         CResult_PublicKeyNoneZ_get_err(owner_conv);
1327 }
1328
1329 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1330         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1331         switch(obj->tag) {
1332                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1333                 case LDKCOption_BigEndianScalarZ_None: return 1;
1334                 default: abort();
1335         }
1336 }
1337 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1338         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1339         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1340         LDKBigEndianScalar* some_ref = &obj->some;
1341         return tag_ptr(some_ref, false);
1342 }
1343 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1344 CHECK(owner->result_ok);
1345         return *owner->contents.result;
1346 }
1347 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1348         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1349         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1350         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1351         return ret_arr;
1352 }
1353
1354 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1355 CHECK(!owner->result_ok);
1356         return *owner->contents.err;
1357 }
1358 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1359         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1360         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1361 }
1362
1363 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1364 CHECK(owner->result_ok);
1365         return *owner->contents.result;
1366 }
1367 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1368         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1369         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1370         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1371         return ret_arr;
1372 }
1373
1374 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1375 CHECK(!owner->result_ok);
1376         return *owner->contents.err;
1377 }
1378 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1379         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1380         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1381 }
1382
1383 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1384 CHECK(owner->result_ok);
1385         return *owner->contents.result;
1386 }
1387 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1388         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1389         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1390         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1391         return ret_arr;
1392 }
1393
1394 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1395 CHECK(!owner->result_ok);
1396         return *owner->contents.err;
1397 }
1398 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1399         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1400         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1401 }
1402
1403 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1404         return owner->a;
1405 }
1406 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1407         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1408         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1409         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1410         return ret_arr;
1411 }
1412
1413 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1414         return owner->b;
1415 }
1416 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1417         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1418         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1419         ptrArray ret_arr = NULL;
1420         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1421         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1422         for (size_t m = 0; m < ret_var.datalen; m++) {
1423                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1424                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1425                 ret_arr_ptr[m] = ret_conv_12_arr;
1426         }
1427         
1428         return ret_arr;
1429 }
1430
1431 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1432 CHECK(owner->result_ok);
1433         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1434 }
1435 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1436         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1437         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1438         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1439         return tag_ptr(ret_conv, true);
1440 }
1441
1442 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1443 CHECK(!owner->result_ok);
1444         return *owner->contents.err;
1445 }
1446 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1447         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1448         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1449 }
1450
1451 typedef struct LDKChannelSigner_JCalls {
1452         atomic_size_t refcnt;
1453         uint32_t instance_ptr;
1454 } LDKChannelSigner_JCalls;
1455 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1456         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1457         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1458                 FREE(j_calls);
1459         }
1460 }
1461 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1462         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1463         int64_t idx_conv = idx;
1464         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1465         LDKPublicKey ret_ref;
1466         CHECK(ret->arr_len == 33);
1467         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1468         return ret_ref;
1469 }
1470 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1471         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1472         int64_t idx_conv = idx;
1473         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1474         LDKThirtyTwoBytes ret_ref;
1475         CHECK(ret->arr_len == 32);
1476         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1477         return ret_ref;
1478 }
1479 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1480         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1481         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1482         uint64_t holder_tx_ref = 0;
1483         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1484         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1485         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1486         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1487         ptrArray outbound_htlc_preimages_arr = NULL;
1488         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1489         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1490         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1491                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1492                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1493                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1494         }
1495         
1496         FREE(outbound_htlc_preimages_var.data);
1497         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)outbound_htlc_preimages_arr, 0, 0, 0, 0);
1498         void* ret_ptr = untag_ptr(ret);
1499         CHECK_ACCESS(ret_ptr);
1500         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1501         FREE(untag_ptr(ret));
1502         return ret_conv;
1503 }
1504 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1505         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1506         int64_t idx_conv = idx;
1507         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1508         memcpy(secret_arr->elems, *secret, 32);
1509         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1510         void* ret_ptr = untag_ptr(ret);
1511         CHECK_ACCESS(ret_ptr);
1512         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1513         FREE(untag_ptr(ret));
1514         return ret_conv;
1515 }
1516 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1517         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1518         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 4, 0, 0, 0, 0, 0, 0);
1519         LDKThirtyTwoBytes ret_ref;
1520         CHECK(ret->arr_len == 32);
1521         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1522         return ret_ref;
1523 }
1524 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1525         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1526         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1527         uint64_t channel_parameters_ref = 0;
1528         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1529         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1530         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1531         js_invoke_function_buuuuu(j_calls->instance_ptr, 5, channel_parameters_ref, 0, 0, 0, 0, 0);
1532 }
1533 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1534         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1535         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1536 }
1537 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1538         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1539         atomic_init(&calls->refcnt, 1);
1540         calls->instance_ptr = o;
1541
1542         LDKChannelPublicKeys pubkeys_conv;
1543         pubkeys_conv.inner = untag_ptr(pubkeys);
1544         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1545         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1546
1547         LDKChannelSigner ret = {
1548                 .this_arg = (void*) calls,
1549                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1550                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1551                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1552                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1553                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1554                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1555                 .free = LDKChannelSigner_JCalls_free,
1556                 .pubkeys = pubkeys_conv,
1557                 .set_pubkeys = NULL,
1558         };
1559         return ret;
1560 }
1561 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1562         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1563         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1564         return tag_ptr(res_ptr, true);
1565 }
1566 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1567         void* this_arg_ptr = untag_ptr(this_arg);
1568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1569         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1570         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1571         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1572         return ret_arr;
1573 }
1574
1575 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1576         void* this_arg_ptr = untag_ptr(this_arg);
1577         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1578         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1579         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1580         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1581         return ret_arr;
1582 }
1583
1584 uint64_t  __attribute__((export_name("TS_ChannelSigner_validate_holder_commitment"))) TS_ChannelSigner_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray outbound_htlc_preimages) {
1585         void* this_arg_ptr = untag_ptr(this_arg);
1586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1587         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1588         LDKHolderCommitmentTransaction holder_tx_conv;
1589         holder_tx_conv.inner = untag_ptr(holder_tx);
1590         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1591         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1592         holder_tx_conv.is_owned = false;
1593         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1594         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1595         if (outbound_htlc_preimages_constr.datalen > 0)
1596                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1597         else
1598                 outbound_htlc_preimages_constr.data = NULL;
1599         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1600         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1601                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1602                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1603                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1604                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1605                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1606         }
1607         FREE(outbound_htlc_preimages);
1608         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1609         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1610         return tag_ptr(ret_conv, true);
1611 }
1612
1613 uint64_t  __attribute__((export_name("TS_ChannelSigner_validate_counterparty_revocation"))) TS_ChannelSigner_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) {
1614         void* this_arg_ptr = untag_ptr(this_arg);
1615         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1616         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1617         uint8_t secret_arr[32];
1618         CHECK(secret->arr_len == 32);
1619         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1620         uint8_t (*secret_ref)[32] = &secret_arr;
1621         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1622         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1623         return tag_ptr(ret_conv, true);
1624 }
1625
1626 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1627         void* this_arg_ptr = untag_ptr(this_arg);
1628         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1629         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1630         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1631         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1632         return ret_arr;
1633 }
1634
1635 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1636         void* this_arg_ptr = untag_ptr(this_arg);
1637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1638         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1639         LDKChannelTransactionParameters channel_parameters_conv;
1640         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1641         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1642         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1643         channel_parameters_conv.is_owned = false;
1644         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1645 }
1646
1647 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1648         if (this_arg->set_pubkeys != NULL)
1649                 this_arg->set_pubkeys(this_arg);
1650         return this_arg->pubkeys;
1651 }
1652 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1653         void* this_arg_ptr = untag_ptr(this_arg);
1654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1655         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1656         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1657         uint64_t ret_ref = 0;
1658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1660         return ret_ref;
1661 }
1662
1663 typedef struct LDKEcdsaChannelSigner_JCalls {
1664         atomic_size_t refcnt;
1665         uint32_t instance_ptr;
1666         LDKChannelSigner_JCalls* ChannelSigner;
1667 } LDKEcdsaChannelSigner_JCalls;
1668 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1669         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1670         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1671                 FREE(j_calls);
1672         }
1673 }
1674 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1675         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1676         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1677         uint64_t commitment_tx_ref = 0;
1678         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1679         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1680         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1681         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1682         ptrArray inbound_htlc_preimages_arr = NULL;
1683         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1684         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1685         for (size_t m = 0; m < inbound_htlc_preimages_var.datalen; m++) {
1686                 int8_tArray inbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1687                 memcpy(inbound_htlc_preimages_conv_12_arr->elems, inbound_htlc_preimages_var.data[m].data, 32);
1688                 inbound_htlc_preimages_arr_ptr[m] = inbound_htlc_preimages_conv_12_arr;
1689         }
1690         
1691         FREE(inbound_htlc_preimages_var.data);
1692         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1693         ptrArray outbound_htlc_preimages_arr = NULL;
1694         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1695         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1696         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1697                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1698                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1699                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1700         }
1701         
1702         FREE(outbound_htlc_preimages_var.data);
1703         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)inbound_htlc_preimages_arr, (uint32_t)outbound_htlc_preimages_arr, 0, 0, 0);
1704         void* ret_ptr = untag_ptr(ret);
1705         CHECK_ACCESS(ret_ptr);
1706         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1707         FREE(untag_ptr(ret));
1708         return ret_conv;
1709 }
1710 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1711         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1712         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1713         uint64_t commitment_tx_ref = 0;
1714         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1715         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1716         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1717         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1718         void* ret_ptr = untag_ptr(ret);
1719         CHECK_ACCESS(ret_ptr);
1720         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1721         FREE(untag_ptr(ret));
1722         return ret_conv;
1723 }
1724 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]) {
1725         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1726         LDKTransaction justice_tx_var = justice_tx;
1727         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1728         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1729         Transaction_free(justice_tx_var);
1730         uint32_t input_conv = input;
1731         int64_t amount_conv = amount;
1732         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1733         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1734         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);
1735         void* ret_ptr = untag_ptr(ret);
1736         CHECK_ACCESS(ret_ptr);
1737         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1738         FREE(untag_ptr(ret));
1739         return ret_conv;
1740 }
1741 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) {
1742         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1743         LDKTransaction justice_tx_var = justice_tx;
1744         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1745         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1746         Transaction_free(justice_tx_var);
1747         uint32_t input_conv = input;
1748         int64_t amount_conv = amount;
1749         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1750         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1751         LDKHTLCOutputInCommitment htlc_var = *htlc;
1752         uint64_t htlc_ref = 0;
1753         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1754         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1755         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1756         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);
1757         void* ret_ptr = untag_ptr(ret);
1758         CHECK_ACCESS(ret_ptr);
1759         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1760         FREE(untag_ptr(ret));
1761         return ret_conv;
1762 }
1763 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1764         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1765         LDKTransaction htlc_tx_var = htlc_tx;
1766         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1767         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1768         Transaction_free(htlc_tx_var);
1769         uint32_t input_conv = input;
1770         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1771         uint64_t htlc_descriptor_ref = 0;
1772         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1773         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1774         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1775         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);
1776         void* ret_ptr = untag_ptr(ret);
1777         CHECK_ACCESS(ret_ptr);
1778         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1779         FREE(untag_ptr(ret));
1780         return ret_conv;
1781 }
1782 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) {
1783         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1784         LDKTransaction htlc_tx_var = htlc_tx;
1785         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1786         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1787         Transaction_free(htlc_tx_var);
1788         uint32_t input_conv = input;
1789         int64_t amount_conv = amount;
1790         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
1791         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1792         LDKHTLCOutputInCommitment htlc_var = *htlc;
1793         uint64_t htlc_ref = 0;
1794         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1795         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1796         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1797         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);
1798         void* ret_ptr = untag_ptr(ret);
1799         CHECK_ACCESS(ret_ptr);
1800         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1801         FREE(untag_ptr(ret));
1802         return ret_conv;
1803 }
1804 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1805         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1806         LDKClosingTransaction closing_tx_var = *closing_tx;
1807         uint64_t closing_tx_ref = 0;
1808         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
1809         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1810         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
1811         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
1812         void* ret_ptr = untag_ptr(ret);
1813         CHECK_ACCESS(ret_ptr);
1814         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1815         FREE(untag_ptr(ret));
1816         return ret_conv;
1817 }
1818 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
1819         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1820         LDKTransaction anchor_tx_var = anchor_tx;
1821         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
1822         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
1823         Transaction_free(anchor_tx_var);
1824         uint32_t input_conv = input;
1825         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
1826         void* ret_ptr = untag_ptr(ret);
1827         CHECK_ACCESS(ret_ptr);
1828         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1829         FREE(untag_ptr(ret));
1830         return ret_conv;
1831 }
1832 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1833         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1834         LDKUnsignedChannelAnnouncement msg_var = *msg;
1835         uint64_t msg_ref = 0;
1836         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
1837         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1838         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
1839         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
1840         void* ret_ptr = untag_ptr(ret);
1841         CHECK_ACCESS(ret_ptr);
1842         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1843         FREE(untag_ptr(ret));
1844         return ret_conv;
1845 }
1846 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
1847         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
1848         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1849         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
1850 }
1851 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1852         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
1853         atomic_init(&calls->refcnt, 1);
1854         calls->instance_ptr = o;
1855
1856         LDKChannelPublicKeys pubkeys_conv;
1857         pubkeys_conv.inner = untag_ptr(pubkeys);
1858         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1859         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1860
1861         LDKEcdsaChannelSigner ret = {
1862                 .this_arg = (void*) calls,
1863                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
1864                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
1865                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
1866                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
1867                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1868                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1869                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
1870                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
1871                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
1872                 .free = LDKEcdsaChannelSigner_JCalls_free,
1873                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
1874         };
1875         calls->ChannelSigner = ret.ChannelSigner.this_arg;
1876         return ret;
1877 }
1878 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1879         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
1880         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
1881         return tag_ptr(res_ptr, true);
1882 }
1883 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_commitment"))) TS_EcdsaChannelSigner_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray inbound_htlc_preimages, ptrArray outbound_htlc_preimages) {
1884         void* this_arg_ptr = untag_ptr(this_arg);
1885         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1886         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1887         LDKCommitmentTransaction commitment_tx_conv;
1888         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1889         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1890         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1891         commitment_tx_conv.is_owned = false;
1892         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
1893         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
1894         if (inbound_htlc_preimages_constr.datalen > 0)
1895                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1896         else
1897                 inbound_htlc_preimages_constr.data = NULL;
1898         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
1899         for (size_t m = 0; m < inbound_htlc_preimages_constr.datalen; m++) {
1900                 int8_tArray inbound_htlc_preimages_conv_12 = inbound_htlc_preimages_vals[m];
1901                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_12_ref;
1902                 CHECK(inbound_htlc_preimages_conv_12->arr_len == 32);
1903                 memcpy(inbound_htlc_preimages_conv_12_ref.data, inbound_htlc_preimages_conv_12->elems, 32); FREE(inbound_htlc_preimages_conv_12);
1904                 inbound_htlc_preimages_constr.data[m] = inbound_htlc_preimages_conv_12_ref;
1905         }
1906         FREE(inbound_htlc_preimages);
1907         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1908         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1909         if (outbound_htlc_preimages_constr.datalen > 0)
1910                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1911         else
1912                 outbound_htlc_preimages_constr.data = NULL;
1913         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1914         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1915                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1916                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1917                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1918                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1919                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1920         }
1921         FREE(outbound_htlc_preimages);
1922         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1923         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
1924         return tag_ptr(ret_conv, true);
1925 }
1926
1927 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
1928         void* this_arg_ptr = untag_ptr(this_arg);
1929         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1930         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1931         LDKHolderCommitmentTransaction commitment_tx_conv;
1932         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1933         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1934         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1935         commitment_tx_conv.is_owned = false;
1936         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1937         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1938         return tag_ptr(ret_conv, true);
1939 }
1940
1941 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) {
1942         void* this_arg_ptr = untag_ptr(this_arg);
1943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1944         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1945         LDKTransaction justice_tx_ref;
1946         justice_tx_ref.datalen = justice_tx->arr_len;
1947         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1948         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1949         justice_tx_ref.data_is_owned = true;
1950         uint8_t per_commitment_key_arr[32];
1951         CHECK(per_commitment_key->arr_len == 32);
1952         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1953         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1954         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1955         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1956         return tag_ptr(ret_conv, true);
1957 }
1958
1959 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) {
1960         void* this_arg_ptr = untag_ptr(this_arg);
1961         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1962         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1963         LDKTransaction justice_tx_ref;
1964         justice_tx_ref.datalen = justice_tx->arr_len;
1965         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1966         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1967         justice_tx_ref.data_is_owned = true;
1968         uint8_t per_commitment_key_arr[32];
1969         CHECK(per_commitment_key->arr_len == 32);
1970         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1971         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1972         LDKHTLCOutputInCommitment htlc_conv;
1973         htlc_conv.inner = untag_ptr(htlc);
1974         htlc_conv.is_owned = ptr_is_owned(htlc);
1975         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1976         htlc_conv.is_owned = false;
1977         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1978         *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);
1979         return tag_ptr(ret_conv, true);
1980 }
1981
1982 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) {
1983         void* this_arg_ptr = untag_ptr(this_arg);
1984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1985         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1986         LDKTransaction htlc_tx_ref;
1987         htlc_tx_ref.datalen = htlc_tx->arr_len;
1988         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1989         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1990         htlc_tx_ref.data_is_owned = true;
1991         LDKHTLCDescriptor htlc_descriptor_conv;
1992         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
1993         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
1994         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
1995         htlc_descriptor_conv.is_owned = false;
1996         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1997         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
1998         return tag_ptr(ret_conv, true);
1999 }
2000
2001 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) {
2002         void* this_arg_ptr = untag_ptr(this_arg);
2003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2004         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2005         LDKTransaction htlc_tx_ref;
2006         htlc_tx_ref.datalen = htlc_tx->arr_len;
2007         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2008         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2009         htlc_tx_ref.data_is_owned = true;
2010         LDKPublicKey per_commitment_point_ref;
2011         CHECK(per_commitment_point->arr_len == 33);
2012         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2013         LDKHTLCOutputInCommitment htlc_conv;
2014         htlc_conv.inner = untag_ptr(htlc);
2015         htlc_conv.is_owned = ptr_is_owned(htlc);
2016         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2017         htlc_conv.is_owned = false;
2018         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2019         *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);
2020         return tag_ptr(ret_conv, true);
2021 }
2022
2023 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2024         void* this_arg_ptr = untag_ptr(this_arg);
2025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2026         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2027         LDKClosingTransaction closing_tx_conv;
2028         closing_tx_conv.inner = untag_ptr(closing_tx);
2029         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2030         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2031         closing_tx_conv.is_owned = false;
2032         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2033         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2034         return tag_ptr(ret_conv, true);
2035 }
2036
2037 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) {
2038         void* this_arg_ptr = untag_ptr(this_arg);
2039         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2040         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2041         LDKTransaction anchor_tx_ref;
2042         anchor_tx_ref.datalen = anchor_tx->arr_len;
2043         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2044         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2045         anchor_tx_ref.data_is_owned = true;
2046         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2047         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2048         return tag_ptr(ret_conv, true);
2049 }
2050
2051 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) {
2052         void* this_arg_ptr = untag_ptr(this_arg);
2053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2054         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2055         LDKUnsignedChannelAnnouncement msg_conv;
2056         msg_conv.inner = untag_ptr(msg);
2057         msg_conv.is_owned = ptr_is_owned(msg);
2058         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2059         msg_conv.is_owned = false;
2060         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2061         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2062         return tag_ptr(ret_conv, true);
2063 }
2064
2065 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2066         atomic_size_t refcnt;
2067         uint32_t instance_ptr;
2068         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2069         LDKChannelSigner_JCalls* ChannelSigner;
2070 } LDKWriteableEcdsaChannelSigner_JCalls;
2071 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2072         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2073         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2074                 FREE(j_calls);
2075         }
2076 }
2077 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2078         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2079         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2080         LDKCVec_u8Z ret_ref;
2081         ret_ref.datalen = ret->arr_len;
2082         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2083         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2084         return ret_ref;
2085 }
2086 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2087         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2088         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2089         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2090         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2091 }
2092 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2093         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2094         atomic_init(&calls->refcnt, 1);
2095         calls->instance_ptr = o;
2096
2097         LDKChannelPublicKeys pubkeys_conv;
2098         pubkeys_conv.inner = untag_ptr(pubkeys);
2099         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2100         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2101
2102         LDKWriteableEcdsaChannelSigner ret = {
2103                 .this_arg = (void*) calls,
2104                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2105                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2106                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2107                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2108         };
2109         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2110         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2111         return ret;
2112 }
2113 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2114         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2115         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2116         return tag_ptr(res_ptr, true);
2117 }
2118 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2119         void* this_arg_ptr = untag_ptr(this_arg);
2120         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2121         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2122         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2123         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2124         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2125         CVec_u8Z_free(ret_var);
2126         return ret_arr;
2127 }
2128
2129 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2130 CHECK(owner->result_ok);
2131         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2132 }
2133 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2134         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2135         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2136         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2137         return tag_ptr(ret_ret, true);
2138 }
2139
2140 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2141 CHECK(!owner->result_ok);
2142         return DecodeError_clone(&*owner->contents.err);
2143 }
2144 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2145         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2147         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2148         uint64_t ret_ref = tag_ptr(ret_copy, true);
2149         return ret_ref;
2150 }
2151
2152 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2153 CHECK(owner->result_ok);
2154         return CVec_u8Z_clone(&*owner->contents.result);
2155 }
2156 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2157         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2158         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2159         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2160         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2161         CVec_u8Z_free(ret_var);
2162         return ret_arr;
2163 }
2164
2165 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2166 CHECK(!owner->result_ok);
2167         return *owner->contents.err;
2168 }
2169 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2170         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2171         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2172 }
2173
2174 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2175         LDKShutdownScript ret = *owner->contents.result;
2176         ret.is_owned = false;
2177         return ret;
2178 }
2179 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2180         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2181         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2182         uint64_t ret_ref = 0;
2183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2185         return ret_ref;
2186 }
2187
2188 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2189 CHECK(!owner->result_ok);
2190         return *owner->contents.err;
2191 }
2192 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2193         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2194         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2195 }
2196
2197 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2198         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2199         switch(obj->tag) {
2200                 case LDKCOption_u16Z_Some: return 0;
2201                 case LDKCOption_u16Z_None: return 1;
2202                 default: abort();
2203         }
2204 }
2205 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2206         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2207         assert(obj->tag == LDKCOption_u16Z_Some);
2208         int16_t some_conv = obj->some;
2209         return some_conv;
2210 }
2211 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2212         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2213         switch(obj->tag) {
2214                 case LDKCOption_boolZ_Some: return 0;
2215                 case LDKCOption_boolZ_None: return 1;
2216                 default: abort();
2217         }
2218 }
2219 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2220         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2221         assert(obj->tag == LDKCOption_boolZ_Some);
2222         jboolean some_conv = obj->some;
2223         return some_conv;
2224 }
2225 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2226 CHECK(owner->result_ok);
2227         return Witness_clone(&*owner->contents.result);
2228 }
2229 int8_tArray  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_ok"))) TS_CResult_WitnessNoneZ_get_ok(uint64_t owner) {
2230         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2231         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2232         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2233         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2234         Witness_free(ret_var);
2235         return ret_arr;
2236 }
2237
2238 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2239 CHECK(!owner->result_ok);
2240         return *owner->contents.err;
2241 }
2242 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_err"))) TS_CResult_WitnessNoneZ_get_err(uint64_t owner) {
2243         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2244         CResult_WitnessNoneZ_get_err(owner_conv);
2245 }
2246
2247 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2248         LDKInMemorySigner ret = *owner->contents.result;
2249         ret.is_owned = false;
2250         return ret;
2251 }
2252 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2253         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2254         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2255         uint64_t ret_ref = 0;
2256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2258         return ret_ref;
2259 }
2260
2261 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2262 CHECK(!owner->result_ok);
2263         return DecodeError_clone(&*owner->contents.err);
2264 }
2265 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2266         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2267         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2268         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2269         uint64_t ret_ref = tag_ptr(ret_copy, true);
2270         return ret_ref;
2271 }
2272
2273 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2274 CHECK(owner->result_ok);
2275         return *owner->contents.result;
2276 }
2277 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2278         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2279         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2280         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2281         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2282         return ret_arr;
2283 }
2284
2285 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2286 CHECK(!owner->result_ok);
2287         return *owner->contents.err;
2288 }
2289 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2290         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2291         CResult_TransactionNoneZ_get_err(owner_conv);
2292 }
2293
2294 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2295         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2296         for (size_t i = 0; i < ret.datalen; i++) {
2297                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2298         }
2299         return ret;
2300 }
2301 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2302         LDKRoute ret = *owner->contents.result;
2303         ret.is_owned = false;
2304         return ret;
2305 }
2306 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2307         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2308         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2309         uint64_t ret_ref = 0;
2310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2312         return ret_ref;
2313 }
2314
2315 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2316         LDKLightningError ret = *owner->contents.err;
2317         ret.is_owned = false;
2318         return ret;
2319 }
2320 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2321         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2322         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2323         uint64_t ret_ref = 0;
2324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2326         return ret_ref;
2327 }
2328
2329 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2330         LDKBlindedPayInfo ret = owner->a;
2331         ret.is_owned = false;
2332         return ret;
2333 }
2334 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2335         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2336         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2337         uint64_t ret_ref = 0;
2338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2340         return ret_ref;
2341 }
2342
2343 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2344         LDKBlindedPath ret = owner->b;
2345         ret.is_owned = false;
2346         return ret;
2347 }
2348 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2349         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2350         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2351         uint64_t ret_ref = 0;
2352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2354         return ret_ref;
2355 }
2356
2357 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2358         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2359         for (size_t i = 0; i < ret.datalen; i++) {
2360                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2361         }
2362         return ret;
2363 }
2364 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2365 CHECK(owner->result_ok);
2366         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
2367 }
2368 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(uint64_t owner) {
2369         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2370         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
2371         uint64_tArray ret_arr = NULL;
2372         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2373         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2374         for (size_t l = 0; l < ret_var.datalen; l++) {
2375                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
2376                 *ret_conv_37_conv = ret_var.data[l];
2377                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
2378         }
2379         
2380         FREE(ret_var.data);
2381         return ret_arr;
2382 }
2383
2384 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2385 CHECK(!owner->result_ok);
2386         return *owner->contents.err;
2387 }
2388 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(uint64_t owner) {
2389         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2390         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
2391 }
2392
2393 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2394         LDKOnionMessagePath ret = *owner->contents.result;
2395         ret.is_owned = false;
2396         return ret;
2397 }
2398 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
2399         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2400         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
2401         uint64_t ret_ref = 0;
2402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2404         return ret_ref;
2405 }
2406
2407 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2408 CHECK(!owner->result_ok);
2409         return *owner->contents.err;
2410 }
2411 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
2412         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2413         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
2414 }
2415
2416 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2417 CHECK(owner->result_ok);
2418         return CVec_BlindedPathZ_clone(&*owner->contents.result);
2419 }
2420 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_get_ok(uint64_t owner) {
2421         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2422         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
2423         uint64_tArray ret_arr = NULL;
2424         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2425         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2426         for (size_t n = 0; n < ret_var.datalen; n++) {
2427                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
2428                 uint64_t ret_conv_13_ref = 0;
2429                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
2430                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
2431                 ret_arr_ptr[n] = ret_conv_13_ref;
2432         }
2433         
2434         FREE(ret_var.data);
2435         return ret_arr;
2436 }
2437
2438 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2439 CHECK(!owner->result_ok);
2440         return *owner->contents.err;
2441 }
2442 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_err"))) TS_CResult_CVec_BlindedPathZNoneZ_get_err(uint64_t owner) {
2443         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2444         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
2445 }
2446
2447 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2448         LDKInFlightHtlcs ret = *owner->contents.result;
2449         ret.is_owned = false;
2450         return ret;
2451 }
2452 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2453         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2454         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2455         uint64_t ret_ref = 0;
2456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2458         return ret_ref;
2459 }
2460
2461 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2462 CHECK(!owner->result_ok);
2463         return DecodeError_clone(&*owner->contents.err);
2464 }
2465 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2466         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2467         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2468         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2469         uint64_t ret_ref = tag_ptr(ret_copy, true);
2470         return ret_ref;
2471 }
2472
2473 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2474         LDKRouteHop ret = *owner->contents.result;
2475         ret.is_owned = false;
2476         return ret;
2477 }
2478 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2479         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2480         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2481         uint64_t ret_ref = 0;
2482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2484         return ret_ref;
2485 }
2486
2487 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2488 CHECK(!owner->result_ok);
2489         return DecodeError_clone(&*owner->contents.err);
2490 }
2491 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2492         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2493         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2494         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2495         uint64_t ret_ref = tag_ptr(ret_copy, true);
2496         return ret_ref;
2497 }
2498
2499 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2500         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2501         for (size_t i = 0; i < ret.datalen; i++) {
2502                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2503         }
2504         return ret;
2505 }
2506 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2507         LDKBlindedTail ret = *owner->contents.result;
2508         ret.is_owned = false;
2509         return ret;
2510 }
2511 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2512         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2513         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2514         uint64_t ret_ref = 0;
2515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2517         return ret_ref;
2518 }
2519
2520 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2521 CHECK(!owner->result_ok);
2522         return DecodeError_clone(&*owner->contents.err);
2523 }
2524 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2525         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2527         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2528         uint64_t ret_ref = tag_ptr(ret_copy, true);
2529         return ret_ref;
2530 }
2531
2532 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2533         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2534         for (size_t i = 0; i < ret.datalen; i++) {
2535                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2536         }
2537         return ret;
2538 }
2539 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2540         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2541         for (size_t i = 0; i < ret.datalen; i++) {
2542                 ret.data[i] = Path_clone(&orig->data[i]);
2543         }
2544         return ret;
2545 }
2546 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2547         LDKRoute ret = *owner->contents.result;
2548         ret.is_owned = false;
2549         return ret;
2550 }
2551 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2552         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2553         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2554         uint64_t ret_ref = 0;
2555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2557         return ret_ref;
2558 }
2559
2560 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2561 CHECK(!owner->result_ok);
2562         return DecodeError_clone(&*owner->contents.err);
2563 }
2564 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2565         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2566         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2567         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2568         uint64_t ret_ref = tag_ptr(ret_copy, true);
2569         return ret_ref;
2570 }
2571
2572 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2573         LDKRouteParameters ret = *owner->contents.result;
2574         ret.is_owned = false;
2575         return ret;
2576 }
2577 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2578         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2579         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2580         uint64_t ret_ref = 0;
2581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2583         return ret_ref;
2584 }
2585
2586 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2587 CHECK(!owner->result_ok);
2588         return DecodeError_clone(&*owner->contents.err);
2589 }
2590 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2591         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2593         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2594         uint64_t ret_ref = tag_ptr(ret_copy, true);
2595         return ret_ref;
2596 }
2597
2598 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2599         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2600         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2601         return ret;
2602 }
2603 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2604         LDKPaymentParameters ret = *owner->contents.result;
2605         ret.is_owned = false;
2606         return ret;
2607 }
2608 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2609         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2610         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2611         uint64_t ret_ref = 0;
2612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2614         return ret_ref;
2615 }
2616
2617 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2618 CHECK(!owner->result_ok);
2619         return DecodeError_clone(&*owner->contents.err);
2620 }
2621 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2622         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2623         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2624         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2625         uint64_t ret_ref = tag_ptr(ret_copy, true);
2626         return ret_ref;
2627 }
2628
2629 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2630         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2631         for (size_t i = 0; i < ret.datalen; i++) {
2632                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2633         }
2634         return ret;
2635 }
2636 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2637         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2638         for (size_t i = 0; i < ret.datalen; i++) {
2639                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2640         }
2641         return ret;
2642 }
2643 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2644         LDKRouteHint ret = *owner->contents.result;
2645         ret.is_owned = false;
2646         return ret;
2647 }
2648 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2649         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2650         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2651         uint64_t ret_ref = 0;
2652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2654         return ret_ref;
2655 }
2656
2657 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2658 CHECK(!owner->result_ok);
2659         return DecodeError_clone(&*owner->contents.err);
2660 }
2661 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2662         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2664         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2665         uint64_t ret_ref = tag_ptr(ret_copy, true);
2666         return ret_ref;
2667 }
2668
2669 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2670         LDKRouteHintHop ret = *owner->contents.result;
2671         ret.is_owned = false;
2672         return ret;
2673 }
2674 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2675         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2676         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2677         uint64_t ret_ref = 0;
2678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2680         return ret_ref;
2681 }
2682
2683 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2684 CHECK(!owner->result_ok);
2685         return DecodeError_clone(&*owner->contents.err);
2686 }
2687 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2688         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2690         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2691         uint64_t ret_ref = tag_ptr(ret_copy, true);
2692         return ret_ref;
2693 }
2694
2695 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2696         LDKFixedPenaltyScorer ret = *owner->contents.result;
2697         ret.is_owned = false;
2698         return ret;
2699 }
2700 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2701         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2702         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2703         uint64_t ret_ref = 0;
2704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2706         return ret_ref;
2707 }
2708
2709 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2710 CHECK(!owner->result_ok);
2711         return DecodeError_clone(&*owner->contents.err);
2712 }
2713 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2714         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2715         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2716         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2717         uint64_t ret_ref = tag_ptr(ret_copy, true);
2718         return ret_ref;
2719 }
2720
2721 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2722         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2723         for (size_t i = 0; i < ret.datalen; i++) {
2724                 ret.data[i] = NodeId_clone(&orig->data[i]);
2725         }
2726         return ret;
2727 }
2728 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2729         return owner->a;
2730 }
2731 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2732         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2733         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2734         return ret_conv;
2735 }
2736
2737 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2738         return owner->b;
2739 }
2740 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2741         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2742         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2743         return ret_conv;
2744 }
2745
2746 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2747         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2748         switch(obj->tag) {
2749                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2750                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2751                 default: abort();
2752         }
2753 }
2754 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2755         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2756         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2757         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2758         *some_conv = obj->some;
2759                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2760         return tag_ptr(some_conv, true);
2761 }
2762 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2763         return owner->a;
2764 }
2765 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2766         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2767         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2768         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2769         return ret_arr;
2770 }
2771
2772 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2773         return owner->b;
2774 }
2775 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2776         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2777         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2778         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2779         return ret_arr;
2780 }
2781
2782 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2783         return owner->a;
2784 }
2785 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2786         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2787         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2788         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2789         return ret_arr;
2790 }
2791
2792 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2793         return owner->b;
2794 }
2795 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2796         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2797         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2798         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
2799         return ret_arr;
2800 }
2801
2802 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
2803         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2804         switch(obj->tag) {
2805                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
2806                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
2807                 default: abort();
2808         }
2809 }
2810 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
2811         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2812         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
2813         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
2814                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
2815         return tag_ptr(some_conv, false);
2816 }
2817 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
2818         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2819         switch(obj->tag) {
2820                 case LDKCOption_f64Z_Some: return 0;
2821                 case LDKCOption_f64Z_None: return 1;
2822                 default: abort();
2823         }
2824 }
2825 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
2826         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2827         assert(obj->tag == LDKCOption_f64Z_Some);
2828         double some_conv = obj->some;
2829         return some_conv;
2830 }
2831 typedef struct LDKLogger_JCalls {
2832         atomic_size_t refcnt;
2833         uint32_t instance_ptr;
2834 } LDKLogger_JCalls;
2835 static void LDKLogger_JCalls_free(void* this_arg) {
2836         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2837         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2838                 FREE(j_calls);
2839         }
2840 }
2841 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
2842         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2843         LDKRecord record_var = record;
2844         uint64_t record_ref = 0;
2845         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2846         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2847         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
2848 }
2849 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2850         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2851         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2852 }
2853 static inline LDKLogger LDKLogger_init (JSValue o) {
2854         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2855         atomic_init(&calls->refcnt, 1);
2856         calls->instance_ptr = o;
2857
2858         LDKLogger ret = {
2859                 .this_arg = (void*) calls,
2860                 .log = log_LDKLogger_jcall,
2861                 .free = LDKLogger_JCalls_free,
2862         };
2863         return ret;
2864 }
2865 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2866         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2867         *res_ptr = LDKLogger_init(o);
2868         return tag_ptr(res_ptr, true);
2869 }
2870 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2871         LDKProbabilisticScorer ret = *owner->contents.result;
2872         ret.is_owned = false;
2873         return ret;
2874 }
2875 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2876         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2877         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2878         uint64_t ret_ref = 0;
2879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2881         return ret_ref;
2882 }
2883
2884 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2885 CHECK(!owner->result_ok);
2886         return DecodeError_clone(&*owner->contents.err);
2887 }
2888 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2889         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2890         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2891         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2892         uint64_t ret_ref = tag_ptr(ret_copy, true);
2893         return ret_ref;
2894 }
2895
2896 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2897         return owner->a;
2898 }
2899 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2900         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2901         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2902         return ret_conv;
2903 }
2904
2905 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2906         return owner->b;
2907 }
2908 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2909         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2910         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2911         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2912         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2913         return ret_arr;
2914 }
2915
2916 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2917         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2918         for (size_t i = 0; i < ret.datalen; i++) {
2919                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2920         }
2921         return ret;
2922 }
2923 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2924         return ThirtyTwoBytes_clone(&owner->a);
2925 }
2926 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
2927         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2928         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2929         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
2930         return ret_arr;
2931 }
2932
2933 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2934         return owner->b;
2935 }
2936 int32_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
2937         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2938         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
2939         return ret_conv;
2940 }
2941
2942 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2943         return COption_ThirtyTwoBytesZ_clone(&owner->c);
2944 }
2945 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(uint64_t owner) {
2946         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2947         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
2948         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
2949         uint64_t ret_ref = tag_ptr(ret_copy, true);
2950         return ret_ref;
2951 }
2952
2953 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
2954         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
2955         for (size_t i = 0; i < ret.datalen; i++) {
2956                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
2957         }
2958         return ret;
2959 }
2960 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2961 CHECK(owner->result_ok);
2962         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
2963 }
2964 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
2965         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2966         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
2967         return ret_conv;
2968 }
2969
2970 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2971 CHECK(!owner->result_ok);
2972         return *owner->contents.err;
2973 }
2974 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
2975         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2976         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
2977 }
2978
2979 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2980         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2981         switch(obj->tag) {
2982                 case LDKMonitorEvent_HTLCEvent: return 0;
2983                 case LDKMonitorEvent_HolderForceClosed: return 1;
2984                 case LDKMonitorEvent_Completed: return 2;
2985                 default: abort();
2986         }
2987 }
2988 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2989         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2990         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2991         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2992                         uint64_t htlc_event_ref = 0;
2993                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2994                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2995         return htlc_event_ref;
2996 }
2997 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
2998         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2999         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
3000         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3001                         uint64_t holder_force_closed_ref = 0;
3002                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3003                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3004         return holder_force_closed_ref;
3005 }
3006 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3007         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3008         assert(obj->tag == LDKMonitorEvent_Completed);
3009         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3010                         uint64_t funding_txo_ref = 0;
3011                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3012                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3013         return funding_txo_ref;
3014 }
3015 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3016         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3017         assert(obj->tag == LDKMonitorEvent_Completed);
3018         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3019         return monitor_update_id_conv;
3020 }
3021 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3022         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3023         for (size_t i = 0; i < ret.datalen; i++) {
3024                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3025         }
3026         return ret;
3027 }
3028 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3029         LDKOutPoint ret = owner->a;
3030         ret.is_owned = false;
3031         return ret;
3032 }
3033 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3034         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3035         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3036         uint64_t ret_ref = 0;
3037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3039         return ret_ref;
3040 }
3041
3042 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3043         return CVec_MonitorEventZ_clone(&owner->b);
3044 }
3045 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3046         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3047         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3048         uint64_tArray ret_arr = NULL;
3049         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3050         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3051         for (size_t o = 0; o < ret_var.datalen; o++) {
3052                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3053                 *ret_conv_14_copy = ret_var.data[o];
3054                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3055                 ret_arr_ptr[o] = ret_conv_14_ref;
3056         }
3057         
3058         FREE(ret_var.data);
3059         return ret_arr;
3060 }
3061
3062 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3063         return owner->c;
3064 }
3065 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3066         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3067         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3068         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3069         return ret_arr;
3070 }
3071
3072 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3073         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3074         for (size_t i = 0; i < ret.datalen; i++) {
3075                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3076         }
3077         return ret;
3078 }
3079 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3080         LDKInitFeatures ret = *owner->contents.result;
3081         ret.is_owned = false;
3082         return ret;
3083 }
3084 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3085         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3086         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3087         uint64_t ret_ref = 0;
3088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3090         return ret_ref;
3091 }
3092
3093 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3094 CHECK(!owner->result_ok);
3095         return DecodeError_clone(&*owner->contents.err);
3096 }
3097 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3098         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3099         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3100         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3101         uint64_t ret_ref = tag_ptr(ret_copy, true);
3102         return ret_ref;
3103 }
3104
3105 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3106         LDKChannelFeatures ret = *owner->contents.result;
3107         ret.is_owned = false;
3108         return ret;
3109 }
3110 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3111         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3112         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3113         uint64_t ret_ref = 0;
3114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3116         return ret_ref;
3117 }
3118
3119 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3120 CHECK(!owner->result_ok);
3121         return DecodeError_clone(&*owner->contents.err);
3122 }
3123 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3124         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3125         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3126         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3127         uint64_t ret_ref = tag_ptr(ret_copy, true);
3128         return ret_ref;
3129 }
3130
3131 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3132         LDKNodeFeatures ret = *owner->contents.result;
3133         ret.is_owned = false;
3134         return ret;
3135 }
3136 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3137         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3138         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3139         uint64_t ret_ref = 0;
3140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3142         return ret_ref;
3143 }
3144
3145 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3146 CHECK(!owner->result_ok);
3147         return DecodeError_clone(&*owner->contents.err);
3148 }
3149 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3150         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3151         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3152         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3153         uint64_t ret_ref = tag_ptr(ret_copy, true);
3154         return ret_ref;
3155 }
3156
3157 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3158         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3159         ret.is_owned = false;
3160         return ret;
3161 }
3162 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3163         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3164         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3165         uint64_t ret_ref = 0;
3166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3168         return ret_ref;
3169 }
3170
3171 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3172 CHECK(!owner->result_ok);
3173         return DecodeError_clone(&*owner->contents.err);
3174 }
3175 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3176         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3177         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3178         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3179         uint64_t ret_ref = tag_ptr(ret_copy, true);
3180         return ret_ref;
3181 }
3182
3183 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3184         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3185         ret.is_owned = false;
3186         return ret;
3187 }
3188 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3189         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3190         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3191         uint64_t ret_ref = 0;
3192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3194         return ret_ref;
3195 }
3196
3197 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3198 CHECK(!owner->result_ok);
3199         return DecodeError_clone(&*owner->contents.err);
3200 }
3201 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3202         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3204         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3205         uint64_t ret_ref = tag_ptr(ret_copy, true);
3206         return ret_ref;
3207 }
3208
3209 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3210         LDKBlindedHopFeatures ret = *owner->contents.result;
3211         ret.is_owned = false;
3212         return ret;
3213 }
3214 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3215         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3216         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3217         uint64_t ret_ref = 0;
3218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3220         return ret_ref;
3221 }
3222
3223 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3224 CHECK(!owner->result_ok);
3225         return DecodeError_clone(&*owner->contents.err);
3226 }
3227 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3228         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3229         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3230         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3231         uint64_t ret_ref = tag_ptr(ret_copy, true);
3232         return ret_ref;
3233 }
3234
3235 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3236         LDKChannelTypeFeatures ret = *owner->contents.result;
3237         ret.is_owned = false;
3238         return ret;
3239 }
3240 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3241         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3242         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3243         uint64_t ret_ref = 0;
3244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3246         return ret_ref;
3247 }
3248
3249 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3250 CHECK(!owner->result_ok);
3251         return DecodeError_clone(&*owner->contents.err);
3252 }
3253 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3254         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3255         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3256         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3257         uint64_t ret_ref = tag_ptr(ret_copy, true);
3258         return ret_ref;
3259 }
3260
3261 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3262         LDKOffer ret = *owner->contents.result;
3263         ret.is_owned = false;
3264         return ret;
3265 }
3266 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3267         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3268         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3269         uint64_t ret_ref = 0;
3270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3272         return ret_ref;
3273 }
3274
3275 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3276         LDKBolt12ParseError ret = *owner->contents.err;
3277         ret.is_owned = false;
3278         return ret;
3279 }
3280 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3281         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3282         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3283         uint64_t ret_ref = 0;
3284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3286         return ret_ref;
3287 }
3288
3289 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3290 CHECK(owner->result_ok);
3291         return *owner->contents.result;
3292 }
3293 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3294         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3295         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3296         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3297         return ret_arr;
3298 }
3299
3300 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3301 CHECK(!owner->result_ok);
3302         return *owner->contents.err;
3303 }
3304 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3305         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3306         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3307         return ret_conv;
3308 }
3309
3310 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3311         LDKNodeId ret = *owner->contents.result;
3312         ret.is_owned = false;
3313         return ret;
3314 }
3315 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3316         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3317         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3318         uint64_t ret_ref = 0;
3319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3321         return ret_ref;
3322 }
3323
3324 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3325 CHECK(!owner->result_ok);
3326         return DecodeError_clone(&*owner->contents.err);
3327 }
3328 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3329         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3330         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3331         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3332         uint64_t ret_ref = tag_ptr(ret_copy, true);
3333         return ret_ref;
3334 }
3335
3336 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3337         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3338         switch(obj->tag) {
3339                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3340                 case LDKNetworkUpdate_ChannelFailure: return 1;
3341                 case LDKNetworkUpdate_NodeFailure: return 2;
3342                 default: abort();
3343         }
3344 }
3345 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3346         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3347         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3348         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3349                         uint64_t msg_ref = 0;
3350                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3351                         msg_ref = tag_ptr(msg_var.inner, false);
3352         return msg_ref;
3353 }
3354 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3355         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3356         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3357         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3358         return short_channel_id_conv;
3359 }
3360 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3361         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3362         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3363         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3364         return is_permanent_conv;
3365 }
3366 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3367         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3368         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3369         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3370         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3371         return node_id_arr;
3372 }
3373 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3374         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3375         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3376         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3377         return is_permanent_conv;
3378 }
3379 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3380         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3381         switch(obj->tag) {
3382                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3383                 case LDKCOption_NetworkUpdateZ_None: return 1;
3384                 default: abort();
3385         }
3386 }
3387 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3388         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3389         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3390         uint64_t some_ref = tag_ptr(&obj->some, false);
3391         return some_ref;
3392 }
3393 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3394 CHECK(owner->result_ok);
3395         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3396 }
3397 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3398         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3399         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3400         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3401         uint64_t ret_ref = tag_ptr(ret_copy, true);
3402         return ret_ref;
3403 }
3404
3405 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3406 CHECK(!owner->result_ok);
3407         return DecodeError_clone(&*owner->contents.err);
3408 }
3409 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3410         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3412         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3413         uint64_t ret_ref = tag_ptr(ret_copy, true);
3414         return ret_ref;
3415 }
3416
3417 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3418 CHECK(owner->result_ok);
3419         return TxOut_clone(&*owner->contents.result);
3420 }
3421 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3422         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3423         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3424         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3425         return tag_ptr(ret_ref, true);
3426 }
3427
3428 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3429 CHECK(!owner->result_ok);
3430         return UtxoLookupError_clone(&*owner->contents.err);
3431 }
3432 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3433         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3434         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3435         return ret_conv;
3436 }
3437
3438 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3439         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3440         switch(obj->tag) {
3441                 case LDKUtxoResult_Sync: return 0;
3442                 case LDKUtxoResult_Async: return 1;
3443                 default: abort();
3444         }
3445 }
3446 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3447         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3448         assert(obj->tag == LDKUtxoResult_Sync);
3449         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3450         *sync_conv = obj->sync;
3451                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3452         return tag_ptr(sync_conv, true);
3453 }
3454 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3455         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3456         assert(obj->tag == LDKUtxoResult_Async);
3457         LDKUtxoFuture async_var = obj->async;
3458                         uint64_t async_ref = 0;
3459                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3460                         async_ref = tag_ptr(async_var.inner, false);
3461         return async_ref;
3462 }
3463 typedef struct LDKUtxoLookup_JCalls {
3464         atomic_size_t refcnt;
3465         uint32_t instance_ptr;
3466 } LDKUtxoLookup_JCalls;
3467 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3468         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3469         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3470                 FREE(j_calls);
3471         }
3472 }
3473 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3474         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3475         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3476         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3477         int64_t short_channel_id_conv = short_channel_id;
3478         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);
3479         void* ret_ptr = untag_ptr(ret);
3480         CHECK_ACCESS(ret_ptr);
3481         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3482         FREE(untag_ptr(ret));
3483         return ret_conv;
3484 }
3485 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3486         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3487         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3488 }
3489 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3490         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3491         atomic_init(&calls->refcnt, 1);
3492         calls->instance_ptr = o;
3493
3494         LDKUtxoLookup ret = {
3495                 .this_arg = (void*) calls,
3496                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3497                 .free = LDKUtxoLookup_JCalls_free,
3498         };
3499         return ret;
3500 }
3501 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3502         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3503         *res_ptr = LDKUtxoLookup_init(o);
3504         return tag_ptr(res_ptr, true);
3505 }
3506 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) {
3507         void* this_arg_ptr = untag_ptr(this_arg);
3508         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3509         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3510         uint8_t chain_hash_arr[32];
3511         CHECK(chain_hash->arr_len == 32);
3512         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3513         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3514         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3515         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3516         uint64_t ret_ref = tag_ptr(ret_copy, true);
3517         return ret_ref;
3518 }
3519
3520 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3521         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3522         switch(obj->tag) {
3523                 case LDKCOption_UtxoLookupZ_Some: return 0;
3524                 case LDKCOption_UtxoLookupZ_None: return 1;
3525                 default: abort();
3526         }
3527 }
3528 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3529         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3530         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3531         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3532         *some_ret = obj->some;
3533                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3534                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3535                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3536                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3537                         }
3538         return tag_ptr(some_ret, true);
3539 }
3540 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3541 CHECK(owner->result_ok);
3542         return *owner->contents.result;
3543 }
3544 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3545         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3546         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3547 }
3548
3549 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3550         LDKLightningError ret = *owner->contents.err;
3551         ret.is_owned = false;
3552         return ret;
3553 }
3554 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3555         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3556         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3557         uint64_t ret_ref = 0;
3558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3560         return ret_ref;
3561 }
3562
3563 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3564 CHECK(owner->result_ok);
3565         return *owner->contents.result;
3566 }
3567 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3568         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3569         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3570         return ret_conv;
3571 }
3572
3573 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3574         LDKLightningError ret = *owner->contents.err;
3575         ret.is_owned = false;
3576         return ret;
3577 }
3578 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3579         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3580         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3581         uint64_t ret_ref = 0;
3582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3584         return ret_ref;
3585 }
3586
3587 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3588         LDKChannelAnnouncement ret = owner->a;
3589         ret.is_owned = false;
3590         return ret;
3591 }
3592 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3593         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3594         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3595         uint64_t ret_ref = 0;
3596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3598         return ret_ref;
3599 }
3600
3601 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3602         LDKChannelUpdate ret = owner->b;
3603         ret.is_owned = false;
3604         return ret;
3605 }
3606 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3607         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3608         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3609         uint64_t ret_ref = 0;
3610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3612         return ret_ref;
3613 }
3614
3615 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3616         LDKChannelUpdate ret = owner->c;
3617         ret.is_owned = false;
3618         return ret;
3619 }
3620 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3621         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3622         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3623         uint64_t ret_ref = 0;
3624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3626         return ret_ref;
3627 }
3628
3629 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3630         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3631         switch(obj->tag) {
3632                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3633                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3634                 default: abort();
3635         }
3636 }
3637 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3638         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3639         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3640         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3641         *some_conv = obj->some;
3642                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3643         return tag_ptr(some_conv, true);
3644 }
3645 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3646         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3647         switch(obj->tag) {
3648                 case LDKErrorAction_DisconnectPeer: return 0;
3649                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
3650                 case LDKErrorAction_IgnoreError: return 2;
3651                 case LDKErrorAction_IgnoreAndLog: return 3;
3652                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
3653                 case LDKErrorAction_SendErrorMessage: return 5;
3654                 case LDKErrorAction_SendWarningMessage: return 6;
3655                 default: abort();
3656         }
3657 }
3658 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3659         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3660         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3661         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3662                         uint64_t msg_ref = 0;
3663                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3664                         msg_ref = tag_ptr(msg_var.inner, false);
3665         return msg_ref;
3666 }
3667 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
3668         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3669         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
3670         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
3671                         uint64_t msg_ref = 0;
3672                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3673                         msg_ref = tag_ptr(msg_var.inner, false);
3674         return msg_ref;
3675 }
3676 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3677         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3678         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3679         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3680         return ignore_and_log_conv;
3681 }
3682 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3683         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3684         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3685         LDKErrorMessage msg_var = obj->send_error_message.msg;
3686                         uint64_t msg_ref = 0;
3687                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3688                         msg_ref = tag_ptr(msg_var.inner, false);
3689         return msg_ref;
3690 }
3691 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3692         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3693         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3694         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3695                         uint64_t msg_ref = 0;
3696                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3697                         msg_ref = tag_ptr(msg_var.inner, false);
3698         return msg_ref;
3699 }
3700 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3701         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3702         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3703         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3704         return log_level_conv;
3705 }
3706 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3707         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3708         switch(obj->tag) {
3709                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3710                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
3711                 case LDKMessageSendEvent_SendOpenChannel: return 2;
3712                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
3713                 case LDKMessageSendEvent_SendFundingCreated: return 4;
3714                 case LDKMessageSendEvent_SendFundingSigned: return 5;
3715                 case LDKMessageSendEvent_SendStfu: return 6;
3716                 case LDKMessageSendEvent_SendSplice: return 7;
3717                 case LDKMessageSendEvent_SendSpliceAck: return 8;
3718                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
3719                 case LDKMessageSendEvent_SendTxAddInput: return 10;
3720                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
3721                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
3722                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
3723                 case LDKMessageSendEvent_SendTxComplete: return 14;
3724                 case LDKMessageSendEvent_SendTxSignatures: return 15;
3725                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
3726                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
3727                 case LDKMessageSendEvent_SendTxAbort: return 18;
3728                 case LDKMessageSendEvent_SendChannelReady: return 19;
3729                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
3730                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
3731                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
3732                 case LDKMessageSendEvent_SendClosingSigned: return 23;
3733                 case LDKMessageSendEvent_SendShutdown: return 24;
3734                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
3735                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
3736                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
3737                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
3738                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
3739                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
3740                 case LDKMessageSendEvent_HandleError: return 31;
3741                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
3742                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
3743                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
3744                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
3745                 default: abort();
3746         }
3747 }
3748 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3749         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3750         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3751         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3752         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3753         return node_id_arr;
3754 }
3755 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3756         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3757         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3758         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3759                         uint64_t msg_ref = 0;
3760                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3761                         msg_ref = tag_ptr(msg_var.inner, false);
3762         return msg_ref;
3763 }
3764 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
3765         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3766         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3767         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3768         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
3769         return node_id_arr;
3770 }
3771 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
3772         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3773         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3774         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
3775                         uint64_t msg_ref = 0;
3776                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3777                         msg_ref = tag_ptr(msg_var.inner, false);
3778         return msg_ref;
3779 }
3780 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3781         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3782         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3783         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3784         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3785         return node_id_arr;
3786 }
3787 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3788         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3789         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3790         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3791                         uint64_t msg_ref = 0;
3792                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3793                         msg_ref = tag_ptr(msg_var.inner, false);
3794         return msg_ref;
3795 }
3796 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
3797         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3798         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3799         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3800         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
3801         return node_id_arr;
3802 }
3803 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
3804         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3805         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3806         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
3807                         uint64_t msg_ref = 0;
3808                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3809                         msg_ref = tag_ptr(msg_var.inner, false);
3810         return msg_ref;
3811 }
3812 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3813         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3814         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3815         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3816         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3817         return node_id_arr;
3818 }
3819 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3820         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3821         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3822         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3823                         uint64_t msg_ref = 0;
3824                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3825                         msg_ref = tag_ptr(msg_var.inner, false);
3826         return msg_ref;
3827 }
3828 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3829         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3830         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3831         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3832         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3833         return node_id_arr;
3834 }
3835 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3836         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3837         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3838         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3839                         uint64_t msg_ref = 0;
3840                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3841                         msg_ref = tag_ptr(msg_var.inner, false);
3842         return msg_ref;
3843 }
3844 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_node_id"))) TS_LDKMessageSendEvent_SendStfu_get_node_id(uint64_t ptr) {
3845         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3846         assert(obj->tag == LDKMessageSendEvent_SendStfu);
3847         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3848         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
3849         return node_id_arr;
3850 }
3851 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_msg"))) TS_LDKMessageSendEvent_SendStfu_get_msg(uint64_t ptr) {
3852         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3853         assert(obj->tag == LDKMessageSendEvent_SendStfu);
3854         LDKStfu msg_var = obj->send_stfu.msg;
3855                         uint64_t msg_ref = 0;
3856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3857                         msg_ref = tag_ptr(msg_var.inner, false);
3858         return msg_ref;
3859 }
3860 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_node_id"))) TS_LDKMessageSendEvent_SendSplice_get_node_id(uint64_t ptr) {
3861         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3862         assert(obj->tag == LDKMessageSendEvent_SendSplice);
3863         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3864         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
3865         return node_id_arr;
3866 }
3867 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_msg"))) TS_LDKMessageSendEvent_SendSplice_get_msg(uint64_t ptr) {
3868         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3869         assert(obj->tag == LDKMessageSendEvent_SendSplice);
3870         LDKSplice msg_var = obj->send_splice.msg;
3871                         uint64_t msg_ref = 0;
3872                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3873                         msg_ref = tag_ptr(msg_var.inner, false);
3874         return msg_ref;
3875 }
3876 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceAck_get_node_id(uint64_t ptr) {
3877         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3878         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
3879         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3880         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
3881         return node_id_arr;
3882 }
3883 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_msg"))) TS_LDKMessageSendEvent_SendSpliceAck_get_msg(uint64_t ptr) {
3884         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3885         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
3886         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
3887                         uint64_t msg_ref = 0;
3888                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3889                         msg_ref = tag_ptr(msg_var.inner, false);
3890         return msg_ref;
3891 }
3892 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id(uint64_t ptr) {
3893         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3894         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
3895         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3896         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
3897         return node_id_arr;
3898 }
3899 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_msg"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_msg(uint64_t ptr) {
3900         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3901         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
3902         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
3903                         uint64_t msg_ref = 0;
3904                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3905                         msg_ref = tag_ptr(msg_var.inner, false);
3906         return msg_ref;
3907 }
3908 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
3909         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3910         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3911         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3912         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
3913         return node_id_arr;
3914 }
3915 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
3916         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3917         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3918         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
3919                         uint64_t msg_ref = 0;
3920                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3921                         msg_ref = tag_ptr(msg_var.inner, false);
3922         return msg_ref;
3923 }
3924 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
3925         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3926         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3927         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3928         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
3929         return node_id_arr;
3930 }
3931 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
3932         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3933         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3934         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
3935                         uint64_t msg_ref = 0;
3936                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3937                         msg_ref = tag_ptr(msg_var.inner, false);
3938         return msg_ref;
3939 }
3940 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
3941         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3942         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3943         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3944         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
3945         return node_id_arr;
3946 }
3947 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
3948         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3949         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3950         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
3951                         uint64_t msg_ref = 0;
3952                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3953                         msg_ref = tag_ptr(msg_var.inner, false);
3954         return msg_ref;
3955 }
3956 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
3957         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3958         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3959         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3960         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
3961         return node_id_arr;
3962 }
3963 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
3964         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3965         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3966         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
3967                         uint64_t msg_ref = 0;
3968                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3969                         msg_ref = tag_ptr(msg_var.inner, false);
3970         return msg_ref;
3971 }
3972 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
3973         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3974         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3975         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3976         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
3977         return node_id_arr;
3978 }
3979 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
3980         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3981         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3982         LDKTxComplete msg_var = obj->send_tx_complete.msg;
3983                         uint64_t msg_ref = 0;
3984                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3985                         msg_ref = tag_ptr(msg_var.inner, false);
3986         return msg_ref;
3987 }
3988 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
3989         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3990         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3991         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3992         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
3993         return node_id_arr;
3994 }
3995 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
3996         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3997         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3998         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
3999                         uint64_t msg_ref = 0;
4000                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4001                         msg_ref = tag_ptr(msg_var.inner, false);
4002         return msg_ref;
4003 }
4004 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4005         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4006         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4007         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4008         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4009         return node_id_arr;
4010 }
4011 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4012         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4013         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4014         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4015                         uint64_t msg_ref = 0;
4016                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4017                         msg_ref = tag_ptr(msg_var.inner, false);
4018         return msg_ref;
4019 }
4020 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4021         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4022         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4023         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4024         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4025         return node_id_arr;
4026 }
4027 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4028         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4029         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4030         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4031                         uint64_t msg_ref = 0;
4032                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4033                         msg_ref = tag_ptr(msg_var.inner, false);
4034         return msg_ref;
4035 }
4036 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4037         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4038         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4039         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4040         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4041         return node_id_arr;
4042 }
4043 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4044         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4045         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4046         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4047                         uint64_t msg_ref = 0;
4048                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4049                         msg_ref = tag_ptr(msg_var.inner, false);
4050         return msg_ref;
4051 }
4052 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4053         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4054         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4055         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4056         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4057         return node_id_arr;
4058 }
4059 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4060         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4061         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4062         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4063                         uint64_t msg_ref = 0;
4064                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4065                         msg_ref = tag_ptr(msg_var.inner, false);
4066         return msg_ref;
4067 }
4068 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4069         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4070         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4071         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4072         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4073         return node_id_arr;
4074 }
4075 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4076         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4077         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4078         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4079                         uint64_t msg_ref = 0;
4080                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4081                         msg_ref = tag_ptr(msg_var.inner, false);
4082         return msg_ref;
4083 }
4084 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4085         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4086         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4087         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4088         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4089         return node_id_arr;
4090 }
4091 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4092         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4093         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4094         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4095                         uint64_t updates_ref = 0;
4096                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4097                         updates_ref = tag_ptr(updates_var.inner, false);
4098         return updates_ref;
4099 }
4100 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4101         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4102         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4103         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4104         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4105         return node_id_arr;
4106 }
4107 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4108         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4109         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4110         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4111                         uint64_t msg_ref = 0;
4112                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4113                         msg_ref = tag_ptr(msg_var.inner, false);
4114         return msg_ref;
4115 }
4116 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4117         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4118         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4119         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4120         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4121         return node_id_arr;
4122 }
4123 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4124         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4125         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4126         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4127                         uint64_t msg_ref = 0;
4128                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4129                         msg_ref = tag_ptr(msg_var.inner, false);
4130         return msg_ref;
4131 }
4132 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4133         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4134         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4135         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4136         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4137         return node_id_arr;
4138 }
4139 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4140         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4141         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4142         LDKShutdown msg_var = obj->send_shutdown.msg;
4143                         uint64_t msg_ref = 0;
4144                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4145                         msg_ref = tag_ptr(msg_var.inner, false);
4146         return msg_ref;
4147 }
4148 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4149         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4150         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4151         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4152         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4153         return node_id_arr;
4154 }
4155 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4156         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4157         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4158         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4159                         uint64_t msg_ref = 0;
4160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4161                         msg_ref = tag_ptr(msg_var.inner, false);
4162         return msg_ref;
4163 }
4164 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4165         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4166         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4167         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4168         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4169         return node_id_arr;
4170 }
4171 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4172         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4173         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4174         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4175                         uint64_t msg_ref = 0;
4176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4177                         msg_ref = tag_ptr(msg_var.inner, false);
4178         return msg_ref;
4179 }
4180 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4181         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4182         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4183         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4184                         uint64_t update_msg_ref = 0;
4185                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4186                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4187         return update_msg_ref;
4188 }
4189 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4190         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4191         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4192         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4193                         uint64_t msg_ref = 0;
4194                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4195                         msg_ref = tag_ptr(msg_var.inner, false);
4196         return msg_ref;
4197 }
4198 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4199         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4200         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4201         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4202                         uint64_t update_msg_ref = 0;
4203                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4204                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4205         return update_msg_ref;
4206 }
4207 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4208         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4209         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4210         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4211                         uint64_t msg_ref = 0;
4212                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4213                         msg_ref = tag_ptr(msg_var.inner, false);
4214         return msg_ref;
4215 }
4216 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4217         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4218         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4219         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4220                         uint64_t msg_ref = 0;
4221                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4222                         msg_ref = tag_ptr(msg_var.inner, false);
4223         return msg_ref;
4224 }
4225 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4226         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4227         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4228         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4229         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4230         return node_id_arr;
4231 }
4232 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4233         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4234         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4235         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4236                         uint64_t msg_ref = 0;
4237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4238                         msg_ref = tag_ptr(msg_var.inner, false);
4239         return msg_ref;
4240 }
4241 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4242         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4243         assert(obj->tag == LDKMessageSendEvent_HandleError);
4244         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4245         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4246         return node_id_arr;
4247 }
4248 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4249         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4250         assert(obj->tag == LDKMessageSendEvent_HandleError);
4251         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4252         return action_ref;
4253 }
4254 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4255         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4256         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4257         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4258         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4259         return node_id_arr;
4260 }
4261 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4262         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4263         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4264         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4265                         uint64_t msg_ref = 0;
4266                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4267                         msg_ref = tag_ptr(msg_var.inner, false);
4268         return msg_ref;
4269 }
4270 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4271         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4272         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4273         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4274         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4275         return node_id_arr;
4276 }
4277 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4278         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4279         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4280         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4281                         uint64_t msg_ref = 0;
4282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4283                         msg_ref = tag_ptr(msg_var.inner, false);
4284         return msg_ref;
4285 }
4286 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4287         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4288         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4289         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4290         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4291         return node_id_arr;
4292 }
4293 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4294         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4295         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4296         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4297                         uint64_t msg_ref = 0;
4298                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4299                         msg_ref = tag_ptr(msg_var.inner, false);
4300         return msg_ref;
4301 }
4302 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4303         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4304         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4305         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4306         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4307         return node_id_arr;
4308 }
4309 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4310         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4311         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4312         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4313                         uint64_t msg_ref = 0;
4314                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4315                         msg_ref = tag_ptr(msg_var.inner, false);
4316         return msg_ref;
4317 }
4318 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4319         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4320         for (size_t i = 0; i < ret.datalen; i++) {
4321                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4322         }
4323         return ret;
4324 }
4325 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4326         LDKChannelUpdateInfo ret = *owner->contents.result;
4327         ret.is_owned = false;
4328         return ret;
4329 }
4330 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4331         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4332         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4333         uint64_t ret_ref = 0;
4334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4336         return ret_ref;
4337 }
4338
4339 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4340 CHECK(!owner->result_ok);
4341         return DecodeError_clone(&*owner->contents.err);
4342 }
4343 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4344         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4346         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4347         uint64_t ret_ref = tag_ptr(ret_copy, true);
4348         return ret_ref;
4349 }
4350
4351 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4352         LDKChannelInfo ret = *owner->contents.result;
4353         ret.is_owned = false;
4354         return ret;
4355 }
4356 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4357         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4358         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4359         uint64_t ret_ref = 0;
4360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4362         return ret_ref;
4363 }
4364
4365 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4366 CHECK(!owner->result_ok);
4367         return DecodeError_clone(&*owner->contents.err);
4368 }
4369 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4370         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4371         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4372         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4373         uint64_t ret_ref = tag_ptr(ret_copy, true);
4374         return ret_ref;
4375 }
4376
4377 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4378         LDKRoutingFees ret = *owner->contents.result;
4379         ret.is_owned = false;
4380         return ret;
4381 }
4382 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4383         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4384         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4385         uint64_t ret_ref = 0;
4386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4388         return ret_ref;
4389 }
4390
4391 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4392 CHECK(!owner->result_ok);
4393         return DecodeError_clone(&*owner->contents.err);
4394 }
4395 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4396         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4397         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4398         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4399         uint64_t ret_ref = tag_ptr(ret_copy, true);
4400         return ret_ref;
4401 }
4402
4403 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4404         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4405         switch(obj->tag) {
4406                 case LDKSocketAddress_TcpIpV4: return 0;
4407                 case LDKSocketAddress_TcpIpV6: return 1;
4408                 case LDKSocketAddress_OnionV2: return 2;
4409                 case LDKSocketAddress_OnionV3: return 3;
4410                 case LDKSocketAddress_Hostname: return 4;
4411                 default: abort();
4412         }
4413 }
4414 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4415         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4416         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4417         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4418         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4419         return addr_arr;
4420 }
4421 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4422         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4423         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4424         int16_t port_conv = obj->tcp_ip_v4.port;
4425         return port_conv;
4426 }
4427 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4428         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4429         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4430         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4431         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4432         return addr_arr;
4433 }
4434 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4435         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4436         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4437         int16_t port_conv = obj->tcp_ip_v6.port;
4438         return port_conv;
4439 }
4440 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4441         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4442         assert(obj->tag == LDKSocketAddress_OnionV2);
4443         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4444         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4445         return onion_v2_arr;
4446 }
4447 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4448         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4449         assert(obj->tag == LDKSocketAddress_OnionV3);
4450         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4451         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4452         return ed25519_pubkey_arr;
4453 }
4454 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4455         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4456         assert(obj->tag == LDKSocketAddress_OnionV3);
4457         int16_t checksum_conv = obj->onion_v3.checksum;
4458         return checksum_conv;
4459 }
4460 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4461         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4462         assert(obj->tag == LDKSocketAddress_OnionV3);
4463         int8_t version_conv = obj->onion_v3.version;
4464         return version_conv;
4465 }
4466 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4467         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4468         assert(obj->tag == LDKSocketAddress_OnionV3);
4469         int16_t port_conv = obj->onion_v3.port;
4470         return port_conv;
4471 }
4472 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4473         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4474         assert(obj->tag == LDKSocketAddress_Hostname);
4475         LDKHostname hostname_var = obj->hostname.hostname;
4476                         uint64_t hostname_ref = 0;
4477                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4478                         hostname_ref = tag_ptr(hostname_var.inner, false);
4479         return hostname_ref;
4480 }
4481 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4482         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4483         assert(obj->tag == LDKSocketAddress_Hostname);
4484         int16_t port_conv = obj->hostname.port;
4485         return port_conv;
4486 }
4487 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4488         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4489         for (size_t i = 0; i < ret.datalen; i++) {
4490                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4491         }
4492         return ret;
4493 }
4494 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4495         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4496         ret.is_owned = false;
4497         return ret;
4498 }
4499 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4500         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4501         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4502         uint64_t ret_ref = 0;
4503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4505         return ret_ref;
4506 }
4507
4508 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4509 CHECK(!owner->result_ok);
4510         return DecodeError_clone(&*owner->contents.err);
4511 }
4512 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4513         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4514         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4515         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4516         uint64_t ret_ref = tag_ptr(ret_copy, true);
4517         return ret_ref;
4518 }
4519
4520 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4521         LDKNodeAlias ret = *owner->contents.result;
4522         ret.is_owned = false;
4523         return ret;
4524 }
4525 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4526         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4527         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4528         uint64_t ret_ref = 0;
4529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4531         return ret_ref;
4532 }
4533
4534 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4535 CHECK(!owner->result_ok);
4536         return DecodeError_clone(&*owner->contents.err);
4537 }
4538 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4539         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4541         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4542         uint64_t ret_ref = tag_ptr(ret_copy, true);
4543         return ret_ref;
4544 }
4545
4546 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4547         LDKNodeInfo ret = *owner->contents.result;
4548         ret.is_owned = false;
4549         return ret;
4550 }
4551 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4552         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4553         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4554         uint64_t ret_ref = 0;
4555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4557         return ret_ref;
4558 }
4559
4560 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4561 CHECK(!owner->result_ok);
4562         return DecodeError_clone(&*owner->contents.err);
4563 }
4564 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4565         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4566         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4567         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4568         uint64_t ret_ref = tag_ptr(ret_copy, true);
4569         return ret_ref;
4570 }
4571
4572 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4573         LDKNetworkGraph ret = *owner->contents.result;
4574         ret.is_owned = false;
4575         return ret;
4576 }
4577 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
4578         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4579         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4580         uint64_t ret_ref = 0;
4581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4583         return ret_ref;
4584 }
4585
4586 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4587 CHECK(!owner->result_ok);
4588         return DecodeError_clone(&*owner->contents.err);
4589 }
4590 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4591         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4593         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4594         uint64_t ret_ref = tag_ptr(ret_copy, true);
4595         return ret_ref;
4596 }
4597
4598 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
4599         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4600         switch(obj->tag) {
4601                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
4602                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
4603                 default: abort();
4604         }
4605 }
4606 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
4607         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4608         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
4609         LDKCVec_SocketAddressZ some_var = obj->some;
4610                         uint64_tArray some_arr = NULL;
4611                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4612                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4613                         for (size_t p = 0; p < some_var.datalen; p++) {
4614                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
4615                                 some_arr_ptr[p] = some_conv_15_ref;
4616                         }
4617                         
4618         return some_arr;
4619 }
4620 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
4621         LDKPendingHTLCInfo ret = *owner->contents.result;
4622         ret.is_owned = false;
4623         return ret;
4624 }
4625 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(uint64_t owner) {
4626         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
4627         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
4628         uint64_t ret_ref = 0;
4629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4631         return ret_ref;
4632 }
4633
4634 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
4635         LDKInboundHTLCErr ret = *owner->contents.err;
4636         ret.is_owned = false;
4637         return ret;
4638 }
4639 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(uint64_t owner) {
4640         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
4641         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
4642         uint64_t ret_ref = 0;
4643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4645         return ret_ref;
4646 }
4647
4648 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
4649         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
4650         for (size_t i = 0; i < ret.datalen; i++) {
4651                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
4652         }
4653         return ret;
4654 }
4655 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
4656         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
4657         for (size_t i = 0; i < ret.datalen; i++) {
4658                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
4659         }
4660         return ret;
4661 }
4662 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
4663         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
4664         for (size_t i = 0; i < ret.datalen; i++) {
4665                 ret.data[i] = Utxo_clone(&orig->data[i]);
4666         }
4667         return ret;
4668 }
4669 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
4670         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4671         switch(obj->tag) {
4672                 case LDKCOption_TxOutZ_Some: return 0;
4673                 case LDKCOption_TxOutZ_None: return 1;
4674                 default: abort();
4675         }
4676 }
4677 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
4678         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4679         assert(obj->tag == LDKCOption_TxOutZ_Some);
4680         LDKTxOut* some_ref = &obj->some;
4681         return tag_ptr(some_ref, false);
4682 }
4683 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
4684         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
4685         for (size_t i = 0; i < ret.datalen; i++) {
4686                 ret.data[i] = Input_clone(&orig->data[i]);
4687         }
4688         return ret;
4689 }
4690 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4691         LDKCoinSelection ret = *owner->contents.result;
4692         ret.is_owned = false;
4693         return ret;
4694 }
4695 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
4696         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4697         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
4698         uint64_t ret_ref = 0;
4699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4701         return ret_ref;
4702 }
4703
4704 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4705 CHECK(!owner->result_ok);
4706         return *owner->contents.err;
4707 }
4708 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
4709         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4710         CResult_CoinSelectionNoneZ_get_err(owner_conv);
4711 }
4712
4713 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4714 CHECK(owner->result_ok);
4715         return CVec_UtxoZ_clone(&*owner->contents.result);
4716 }
4717 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
4718         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4719         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
4720         uint64_tArray ret_arr = NULL;
4721         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4722         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4723         for (size_t g = 0; g < ret_var.datalen; g++) {
4724                 LDKUtxo ret_conv_6_var = ret_var.data[g];
4725                 uint64_t ret_conv_6_ref = 0;
4726                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
4727                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
4728                 ret_arr_ptr[g] = ret_conv_6_ref;
4729         }
4730         
4731         FREE(ret_var.data);
4732         return ret_arr;
4733 }
4734
4735 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4736 CHECK(!owner->result_ok);
4737         return *owner->contents.err;
4738 }
4739 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
4740         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4741         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
4742 }
4743
4744 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4745         return owner->a;
4746 }
4747 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
4748         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4749         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
4750         return ret_conv;
4751 }
4752
4753 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4754         return owner->b;
4755 }
4756 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
4757         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4758         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
4759         return ret_conv;
4760 }
4761
4762 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
4763         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4764         switch(obj->tag) {
4765                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
4766                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
4767                 default: abort();
4768         }
4769 }
4770 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
4771         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4772         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
4773         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
4774         *some_conv = obj->some;
4775                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
4776         return tag_ptr(some_conv, true);
4777 }
4778 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
4779         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4780         switch(obj->tag) {
4781                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
4782                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
4783                 default: abort();
4784         }
4785 }
4786 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
4787         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4788         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
4789         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
4790         return some_conv;
4791 }
4792 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4793 CHECK(owner->result_ok);
4794         return ThirtyTwoBytes_clone(&*owner->contents.result);
4795 }
4796 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
4797         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4798         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4799         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
4800         return ret_arr;
4801 }
4802
4803 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4804 CHECK(!owner->result_ok);
4805         return APIError_clone(&*owner->contents.err);
4806 }
4807 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
4808         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4809         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4810         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
4811         uint64_t ret_ref = tag_ptr(ret_copy, true);
4812         return ret_ref;
4813 }
4814
4815 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4816         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4817         switch(obj->tag) {
4818                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
4819                 case LDKRecentPaymentDetails_Pending: return 1;
4820                 case LDKRecentPaymentDetails_Fulfilled: return 2;
4821                 case LDKRecentPaymentDetails_Abandoned: return 3;
4822                 default: abort();
4823         }
4824 }
4825 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
4826         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4827         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
4828         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4829         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
4830         return payment_id_arr;
4831 }
4832 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
4833         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4834         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4835         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4836         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
4837         return payment_id_arr;
4838 }
4839 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4840         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4841         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4842         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4843         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4844         return payment_hash_arr;
4845 }
4846 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4847         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4848         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4849         int64_t total_msat_conv = obj->pending.total_msat;
4850         return total_msat_conv;
4851 }
4852 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
4853         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4854         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4855         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4856         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
4857         return payment_id_arr;
4858 }
4859 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4860         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4861         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4862         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
4863         return payment_hash_ref;
4864 }
4865 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
4866         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4867         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4868         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4869         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
4870         return payment_id_arr;
4871 }
4872 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4873         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4874         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4875         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4876         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4877         return payment_hash_arr;
4878 }
4879 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4880         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4881         for (size_t i = 0; i < ret.datalen; i++) {
4882                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4883         }
4884         return ret;
4885 }
4886 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4887         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4888         switch(obj->tag) {
4889                 case LDKPaymentSendFailure_ParameterError: return 0;
4890                 case LDKPaymentSendFailure_PathParameterError: return 1;
4891                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4892                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4893                 case LDKPaymentSendFailure_PartialFailure: return 4;
4894                 default: abort();
4895         }
4896 }
4897 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4898         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4899         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4900         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4901         return parameter_error_ref;
4902 }
4903 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4904         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4905         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4906         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4907                         uint64_tArray path_parameter_error_arr = NULL;
4908                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4909                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4910                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4911                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4912                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4913                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4914                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4915                         }
4916                         
4917         return path_parameter_error_arr;
4918 }
4919 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4920         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4921         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4922         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4923                         uint64_tArray all_failed_resend_safe_arr = NULL;
4924                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4925                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4926                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4927                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4928                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4929                         }
4930                         
4931         return all_failed_resend_safe_arr;
4932 }
4933 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4934         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4935         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4936         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4937                         uint64_tArray results_arr = NULL;
4938                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4939                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4940                         for (size_t w = 0; w < results_var.datalen; w++) {
4941                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4942                                 *results_conv_22_conv = results_var.data[w];
4943                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4944                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4945                         }
4946                         
4947         return results_arr;
4948 }
4949 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4950         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4951         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4952         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4953                         uint64_t failed_paths_retry_ref = 0;
4954                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4955                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4956         return failed_paths_retry_ref;
4957 }
4958 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4959         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4960         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4961         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4962         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4963         return payment_id_arr;
4964 }
4965 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4966 CHECK(owner->result_ok);
4967         return *owner->contents.result;
4968 }
4969 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4970         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4971         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4972 }
4973
4974 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4975 CHECK(!owner->result_ok);
4976         return PaymentSendFailure_clone(&*owner->contents.err);
4977 }
4978 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4979         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4980         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4981         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4982         uint64_t ret_ref = tag_ptr(ret_copy, true);
4983         return ret_ref;
4984 }
4985
4986 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4987 CHECK(owner->result_ok);
4988         return *owner->contents.result;
4989 }
4990 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4991         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4992         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4993 }
4994
4995 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4996 CHECK(!owner->result_ok);
4997         return RetryableSendFailure_clone(&*owner->contents.err);
4998 }
4999 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5000         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5001         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5002         return ret_conv;
5003 }
5004
5005 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5006 CHECK(owner->result_ok);
5007         return ThirtyTwoBytes_clone(&*owner->contents.result);
5008 }
5009 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
5010         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5011         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5012         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5013         return ret_arr;
5014 }
5015
5016 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5017 CHECK(!owner->result_ok);
5018         return PaymentSendFailure_clone(&*owner->contents.err);
5019 }
5020 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
5021         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5022         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5023         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5024         uint64_t ret_ref = tag_ptr(ret_copy, true);
5025         return ret_ref;
5026 }
5027
5028 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5029 CHECK(owner->result_ok);
5030         return ThirtyTwoBytes_clone(&*owner->contents.result);
5031 }
5032 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
5033         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5034         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5035         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5036         return ret_arr;
5037 }
5038
5039 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5040 CHECK(!owner->result_ok);
5041         return RetryableSendFailure_clone(&*owner->contents.err);
5042 }
5043 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
5044         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5045         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5046         return ret_conv;
5047 }
5048
5049 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5050         return ThirtyTwoBytes_clone(&owner->a);
5051 }
5052 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
5053         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5054         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5055         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5056         return ret_arr;
5057 }
5058
5059 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5060         return ThirtyTwoBytes_clone(&owner->b);
5061 }
5062 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
5063         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5064         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5065         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5066         return ret_arr;
5067 }
5068
5069 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5070 CHECK(owner->result_ok);
5071         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5072 }
5073 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
5074         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5075         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5076         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5077         return tag_ptr(ret_conv, true);
5078 }
5079
5080 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5081 CHECK(!owner->result_ok);
5082         return PaymentSendFailure_clone(&*owner->contents.err);
5083 }
5084 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
5085         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5086         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5087         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5088         uint64_t ret_ref = tag_ptr(ret_copy, true);
5089         return ret_ref;
5090 }
5091
5092 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5093         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5094         for (size_t i = 0; i < ret.datalen; i++) {
5095                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5096         }
5097         return ret;
5098 }
5099 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
5100         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5101         switch(obj->tag) {
5102                 case LDKProbeSendFailure_RouteNotFound: return 0;
5103                 case LDKProbeSendFailure_SendingFailed: return 1;
5104                 default: abort();
5105         }
5106 }
5107 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
5108         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5109         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
5110         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5111         return sending_failed_ref;
5112 }
5113 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5114 CHECK(owner->result_ok);
5115         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5116 }
5117 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
5118         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5119         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5120         uint64_tArray ret_arr = NULL;
5121         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5122         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5123         for (size_t o = 0; o < ret_var.datalen; o++) {
5124                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5125                 *ret_conv_40_conv = ret_var.data[o];
5126                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5127         }
5128         
5129         FREE(ret_var.data);
5130         return ret_arr;
5131 }
5132
5133 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5134 CHECK(!owner->result_ok);
5135         return ProbeSendFailure_clone(&*owner->contents.err);
5136 }
5137 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
5138         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5139         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5140         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5141         uint64_t ret_ref = tag_ptr(ret_copy, true);
5142         return ret_ref;
5143 }
5144
5145 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5146         return ThirtyTwoBytes_clone(&owner->a);
5147 }
5148 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(uint64_t owner) {
5149         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5150         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5151         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
5152         return ret_arr;
5153 }
5154
5155 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5156         return owner->b;
5157 }
5158 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(uint64_t owner) {
5159         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5160         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5161         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5162         return ret_arr;
5163 }
5164
5165 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
5166         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5167         for (size_t i = 0; i < ret.datalen; i++) {
5168                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
5169         }
5170         return ret;
5171 }
5172 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5173         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5174         switch(obj->tag) {
5175                 case LDKCOption_StrZ_Some: return 0;
5176                 case LDKCOption_StrZ_None: return 1;
5177                 default: abort();
5178         }
5179 }
5180 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5181         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5182         assert(obj->tag == LDKCOption_StrZ_Some);
5183         LDKStr some_str = obj->some;
5184                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5185         return some_conv;
5186 }
5187 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5188 CHECK(owner->result_ok);
5189         return *owner->contents.result;
5190 }
5191 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5192         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5193         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
5194 }
5195
5196 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5197 CHECK(!owner->result_ok);
5198         return Bolt12SemanticError_clone(&*owner->contents.err);
5199 }
5200 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
5201         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5202         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
5203         return ret_conv;
5204 }
5205
5206 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5207 CHECK(owner->result_ok);
5208         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5209 }
5210 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5211         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5212         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5213         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5214         return tag_ptr(ret_conv, true);
5215 }
5216
5217 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5218 CHECK(!owner->result_ok);
5219         return *owner->contents.err;
5220 }
5221 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5222         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5223         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5224 }
5225
5226 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5227         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5228         switch(obj->tag) {
5229                 case LDKOffersMessage_InvoiceRequest: return 0;
5230                 case LDKOffersMessage_Invoice: return 1;
5231                 case LDKOffersMessage_InvoiceError: return 2;
5232                 default: abort();
5233         }
5234 }
5235 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5236         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5237         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5238         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5239                         uint64_t invoice_request_ref = 0;
5240                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5241                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5242         return invoice_request_ref;
5243 }
5244 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5245         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5246         assert(obj->tag == LDKOffersMessage_Invoice);
5247         LDKBolt12Invoice invoice_var = obj->invoice;
5248                         uint64_t invoice_ref = 0;
5249                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5250                         invoice_ref = tag_ptr(invoice_var.inner, false);
5251         return invoice_ref;
5252 }
5253 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5254         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5255         assert(obj->tag == LDKOffersMessage_InvoiceError);
5256         LDKInvoiceError invoice_error_var = obj->invoice_error;
5257                         uint64_t invoice_error_ref = 0;
5258                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5259                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5260         return invoice_error_ref;
5261 }
5262 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5263         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5264         switch(obj->tag) {
5265                 case LDKCOption_OffersMessageZ_Some: return 0;
5266                 case LDKCOption_OffersMessageZ_None: return 1;
5267                 default: abort();
5268         }
5269 }
5270 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5271         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5272         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5273         uint64_t some_ref = tag_ptr(&obj->some, false);
5274         return some_ref;
5275 }
5276 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5277         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5278         switch(obj->tag) {
5279                 case LDKDestination_Node: return 0;
5280                 case LDKDestination_BlindedPath: return 1;
5281                 default: abort();
5282         }
5283 }
5284 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5285         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5286         assert(obj->tag == LDKDestination_Node);
5287         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5288         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5289         return node_arr;
5290 }
5291 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5292         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5293         assert(obj->tag == LDKDestination_BlindedPath);
5294         LDKBlindedPath blinded_path_var = obj->blinded_path;
5295                         uint64_t blinded_path_ref = 0;
5296                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5297                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5298         return blinded_path_ref;
5299 }
5300 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5301         return OffersMessage_clone(&owner->a);
5302 }
5303 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5304         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5305         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5306         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5307         uint64_t ret_ref = tag_ptr(ret_copy, true);
5308         return ret_ref;
5309 }
5310
5311 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5312         return Destination_clone(&owner->b);
5313 }
5314 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5315         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5316         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5317         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5318         uint64_t ret_ref = tag_ptr(ret_copy, true);
5319         return ret_ref;
5320 }
5321
5322 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5323         LDKBlindedPath ret = owner->c;
5324         ret.is_owned = false;
5325         return ret;
5326 }
5327 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5328         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5329         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5330         uint64_t ret_ref = 0;
5331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5333         return ret_ref;
5334 }
5335
5336 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5337         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5338         for (size_t i = 0; i < ret.datalen; i++) {
5339                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5340         }
5341         return ret;
5342 }
5343 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5344         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5345         ret.is_owned = false;
5346         return ret;
5347 }
5348 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5349         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5350         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5351         uint64_t ret_ref = 0;
5352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5354         return ret_ref;
5355 }
5356
5357 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5358 CHECK(!owner->result_ok);
5359         return DecodeError_clone(&*owner->contents.err);
5360 }
5361 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5362         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5363         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5364         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5365         uint64_t ret_ref = tag_ptr(ret_copy, true);
5366         return ret_ref;
5367 }
5368
5369 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5370         LDKChannelCounterparty ret = *owner->contents.result;
5371         ret.is_owned = false;
5372         return ret;
5373 }
5374 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5375         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5376         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5377         uint64_t ret_ref = 0;
5378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5380         return ret_ref;
5381 }
5382
5383 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5384 CHECK(!owner->result_ok);
5385         return DecodeError_clone(&*owner->contents.err);
5386 }
5387 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5388         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5389         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5390         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5391         uint64_t ret_ref = tag_ptr(ret_copy, true);
5392         return ret_ref;
5393 }
5394
5395 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5396         LDKChannelDetails ret = *owner->contents.result;
5397         ret.is_owned = false;
5398         return ret;
5399 }
5400 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5401         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5402         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5403         uint64_t ret_ref = 0;
5404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5406         return ret_ref;
5407 }
5408
5409 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5410 CHECK(!owner->result_ok);
5411         return DecodeError_clone(&*owner->contents.err);
5412 }
5413 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5414         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5415         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5416         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5417         uint64_t ret_ref = tag_ptr(ret_copy, true);
5418         return ret_ref;
5419 }
5420
5421 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5422         LDKPhantomRouteHints ret = *owner->contents.result;
5423         ret.is_owned = false;
5424         return ret;
5425 }
5426 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5427         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5428         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5429         uint64_t ret_ref = 0;
5430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5432         return ret_ref;
5433 }
5434
5435 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5436 CHECK(!owner->result_ok);
5437         return DecodeError_clone(&*owner->contents.err);
5438 }
5439 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5440         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5441         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5442         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5443         uint64_t ret_ref = tag_ptr(ret_copy, true);
5444         return ret_ref;
5445 }
5446
5447 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5448         LDKBlindedForward ret = *owner->contents.result;
5449         ret.is_owned = false;
5450         return ret;
5451 }
5452 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_get_ok(uint64_t owner) {
5453         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5454         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
5455         uint64_t ret_ref = 0;
5456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5458         return ret_ref;
5459 }
5460
5461 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5462 CHECK(!owner->result_ok);
5463         return DecodeError_clone(&*owner->contents.err);
5464 }
5465 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_err"))) TS_CResult_BlindedForwardDecodeErrorZ_get_err(uint64_t owner) {
5466         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5467         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5468         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
5469         uint64_t ret_ref = tag_ptr(ret_copy, true);
5470         return ret_ref;
5471 }
5472
5473 uint32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ty_from_ptr"))) TS_LDKPendingHTLCRouting_ty_from_ptr(uint64_t ptr) {
5474         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5475         switch(obj->tag) {
5476                 case LDKPendingHTLCRouting_Forward: return 0;
5477                 case LDKPendingHTLCRouting_Receive: return 1;
5478                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
5479                 default: abort();
5480         }
5481 }
5482 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_onion_packet"))) TS_LDKPendingHTLCRouting_Forward_get_onion_packet(uint64_t ptr) {
5483         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5484         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5485         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
5486                         uint64_t onion_packet_ref = 0;
5487                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
5488                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
5489         return onion_packet_ref;
5490 }
5491 int64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_short_channel_id"))) TS_LDKPendingHTLCRouting_Forward_get_short_channel_id(uint64_t ptr) {
5492         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5493         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5494         int64_t short_channel_id_conv = obj->forward.short_channel_id;
5495         return short_channel_id_conv;
5496 }
5497 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_blinded"))) TS_LDKPendingHTLCRouting_Forward_get_blinded(uint64_t ptr) {
5498         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5499         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5500         LDKBlindedForward blinded_var = obj->forward.blinded;
5501                         uint64_t blinded_ref = 0;
5502                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
5503                         blinded_ref = tag_ptr(blinded_var.inner, false);
5504         return blinded_ref;
5505 }
5506 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_data"))) TS_LDKPendingHTLCRouting_Receive_get_payment_data(uint64_t ptr) {
5507         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5508         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5509         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
5510                         uint64_t payment_data_ref = 0;
5511                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
5512                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
5513         return payment_data_ref;
5514 }
5515 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_metadata"))) TS_LDKPendingHTLCRouting_Receive_get_payment_metadata(uint64_t ptr) {
5516         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5517         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5518         uint64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
5519         return payment_metadata_ref;
5520 }
5521 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(uint64_t ptr) {
5522         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5523         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5524         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
5525         return incoming_cltv_expiry_conv;
5526 }
5527 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret"))) TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(uint64_t ptr) {
5528         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5529         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5530         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
5531         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
5532         return phantom_shared_secret_arr;
5533 }
5534 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs(uint64_t ptr) {
5535         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5536         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5537         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
5538                         uint64_tArray custom_tlvs_arr = NULL;
5539                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
5540                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
5541                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
5542                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
5543                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
5544                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
5545                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
5546                         }
5547                         
5548         return custom_tlvs_arr;
5549 }
5550 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(uint64_t ptr) {
5551         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5552         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5553         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
5554         return requires_blinded_error_conv;
5555 }
5556 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(uint64_t ptr) {
5557         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5558         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5559         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
5560                         uint64_t payment_data_ref = 0;
5561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
5562                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
5563         return payment_data_ref;
5564 }
5565 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(uint64_t ptr) {
5566         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5567         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5568         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
5569         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
5570         return payment_preimage_arr;
5571 }
5572 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(uint64_t ptr) {
5573         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5574         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5575         uint64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
5576         return payment_metadata_ref;
5577 }
5578 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(uint64_t ptr) {
5579         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5580         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5581         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
5582         return incoming_cltv_expiry_conv;
5583 }
5584 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(uint64_t ptr) {
5585         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5586         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5587         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
5588                         uint64_tArray custom_tlvs_arr = NULL;
5589                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
5590                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
5591                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
5592                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
5593                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
5594                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
5595                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
5596                         }
5597                         
5598         return custom_tlvs_arr;
5599 }
5600 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
5601 CHECK(owner->result_ok);
5602         return PendingHTLCRouting_clone(&*owner->contents.result);
5603 }
5604 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(uint64_t owner) {
5605         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
5606         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
5607         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
5608         uint64_t ret_ref = tag_ptr(ret_copy, true);
5609         return ret_ref;
5610 }
5611
5612 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
5613 CHECK(!owner->result_ok);
5614         return DecodeError_clone(&*owner->contents.err);
5615 }
5616 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(uint64_t owner) {
5617         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
5618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5619         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
5620         uint64_t ret_ref = tag_ptr(ret_copy, true);
5621         return ret_ref;
5622 }
5623
5624 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
5625         LDKPendingHTLCInfo ret = *owner->contents.result;
5626         ret.is_owned = false;
5627         return ret;
5628 }
5629 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(uint64_t owner) {
5630         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
5631         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
5632         uint64_t ret_ref = 0;
5633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5635         return ret_ref;
5636 }
5637
5638 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
5639 CHECK(!owner->result_ok);
5640         return DecodeError_clone(&*owner->contents.err);
5641 }
5642 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err(uint64_t owner) {
5643         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
5644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5645         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
5646         uint64_t ret_ref = tag_ptr(ret_copy, true);
5647         return ret_ref;
5648 }
5649
5650 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
5651 CHECK(owner->result_ok);
5652         return BlindedFailure_clone(&*owner->contents.result);
5653 }
5654 uint32_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_get_ok(uint64_t owner) {
5655         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
5656         uint32_t ret_conv = LDKBlindedFailure_to_js(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
5657         return ret_conv;
5658 }
5659
5660 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
5661 CHECK(!owner->result_ok);
5662         return DecodeError_clone(&*owner->contents.err);
5663 }
5664 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_err"))) TS_CResult_BlindedFailureDecodeErrorZ_get_err(uint64_t owner) {
5665         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
5666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5667         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
5668         uint64_t ret_ref = tag_ptr(ret_copy, true);
5669         return ret_ref;
5670 }
5671
5672 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5673 CHECK(owner->result_ok);
5674         return ChannelShutdownState_clone(&*owner->contents.result);
5675 }
5676 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
5677         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5678         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
5679         return ret_conv;
5680 }
5681
5682 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5683 CHECK(!owner->result_ok);
5684         return DecodeError_clone(&*owner->contents.err);
5685 }
5686 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
5687         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5688         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5689         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
5690         uint64_t ret_ref = tag_ptr(ret_copy, true);
5691         return ret_ref;
5692 }
5693
5694 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5695         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5696         for (size_t i = 0; i < ret.datalen; i++) {
5697                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5698         }
5699         return ret;
5700 }
5701 typedef struct LDKWatch_JCalls {
5702         atomic_size_t refcnt;
5703         uint32_t instance_ptr;
5704 } LDKWatch_JCalls;
5705 static void LDKWatch_JCalls_free(void* this_arg) {
5706         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5707         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5708                 FREE(j_calls);
5709         }
5710 }
5711 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5712         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5713         LDKOutPoint funding_txo_var = funding_txo;
5714         uint64_t funding_txo_ref = 0;
5715         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5716         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5717         LDKChannelMonitor monitor_var = monitor;
5718         uint64_t monitor_ref = 0;
5719         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5720         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5721         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5722         void* ret_ptr = untag_ptr(ret);
5723         CHECK_ACCESS(ret_ptr);
5724         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
5725         FREE(untag_ptr(ret));
5726         return ret_conv;
5727 }
5728 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5729         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5730         LDKOutPoint funding_txo_var = funding_txo;
5731         uint64_t funding_txo_ref = 0;
5732         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5733         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5734         LDKChannelMonitorUpdate update_var = *update;
5735         uint64_t update_ref = 0;
5736         update_var = ChannelMonitorUpdate_clone(&update_var);
5737         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5738         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5739         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
5740         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5741         return ret_conv;
5742 }
5743 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5744         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5745         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
5746         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5747         ret_constr.datalen = ret->arr_len;
5748         if (ret_constr.datalen > 0)
5749                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5750         else
5751                 ret_constr.data = NULL;
5752         uint64_t* ret_vals = ret->elems;
5753         for (size_t x = 0; x < ret_constr.datalen; x++) {
5754                 uint64_t ret_conv_49 = ret_vals[x];
5755                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5756                 CHECK_ACCESS(ret_conv_49_ptr);
5757                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5758                 FREE(untag_ptr(ret_conv_49));
5759                 ret_constr.data[x] = ret_conv_49_conv;
5760         }
5761         FREE(ret);
5762         return ret_constr;
5763 }
5764 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5765         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5766         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5767 }
5768 static inline LDKWatch LDKWatch_init (JSValue o) {
5769         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5770         atomic_init(&calls->refcnt, 1);
5771         calls->instance_ptr = o;
5772
5773         LDKWatch ret = {
5774                 .this_arg = (void*) calls,
5775                 .watch_channel = watch_channel_LDKWatch_jcall,
5776                 .update_channel = update_channel_LDKWatch_jcall,
5777                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5778                 .free = LDKWatch_JCalls_free,
5779         };
5780         return ret;
5781 }
5782 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5783         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5784         *res_ptr = LDKWatch_init(o);
5785         return tag_ptr(res_ptr, true);
5786 }
5787 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5788         void* this_arg_ptr = untag_ptr(this_arg);
5789         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5790         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5791         LDKOutPoint funding_txo_conv;
5792         funding_txo_conv.inner = untag_ptr(funding_txo);
5793         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5794         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5795         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5796         LDKChannelMonitor monitor_conv;
5797         monitor_conv.inner = untag_ptr(monitor);
5798         monitor_conv.is_owned = ptr_is_owned(monitor);
5799         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5800         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5801         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
5802         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5803         return tag_ptr(ret_conv, true);
5804 }
5805
5806 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5807         void* this_arg_ptr = untag_ptr(this_arg);
5808         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5809         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5810         LDKOutPoint funding_txo_conv;
5811         funding_txo_conv.inner = untag_ptr(funding_txo);
5812         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5813         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5814         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5815         LDKChannelMonitorUpdate update_conv;
5816         update_conv.inner = untag_ptr(update);
5817         update_conv.is_owned = ptr_is_owned(update);
5818         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5819         update_conv.is_owned = false;
5820         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5821         return ret_conv;
5822 }
5823
5824 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5825         void* this_arg_ptr = untag_ptr(this_arg);
5826         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5827         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5828         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5829         uint64_tArray ret_arr = NULL;
5830         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5831         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5832         for (size_t x = 0; x < ret_var.datalen; x++) {
5833                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5834                 *ret_conv_49_conv = ret_var.data[x];
5835                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5836         }
5837         
5838         FREE(ret_var.data);
5839         return ret_arr;
5840 }
5841
5842 typedef struct LDKBroadcasterInterface_JCalls {
5843         atomic_size_t refcnt;
5844         uint32_t instance_ptr;
5845 } LDKBroadcasterInterface_JCalls;
5846 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5847         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5848         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5849                 FREE(j_calls);
5850         }
5851 }
5852 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
5853         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5854         LDKCVec_TransactionZ txs_var = txs;
5855         ptrArray txs_arr = NULL;
5856         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
5857         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
5858         for (size_t m = 0; m < txs_var.datalen; m++) {
5859                 LDKTransaction txs_conv_12_var = txs_var.data[m];
5860                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
5861                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
5862                 Transaction_free(txs_conv_12_var);
5863                 txs_arr_ptr[m] = txs_conv_12_arr;
5864         }
5865         
5866         FREE(txs_var.data);
5867         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
5868 }
5869 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5870         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5871         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5872 }
5873 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5874         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5875         atomic_init(&calls->refcnt, 1);
5876         calls->instance_ptr = o;
5877
5878         LDKBroadcasterInterface ret = {
5879                 .this_arg = (void*) calls,
5880                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
5881                 .free = LDKBroadcasterInterface_JCalls_free,
5882         };
5883         return ret;
5884 }
5885 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5886         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5887         *res_ptr = LDKBroadcasterInterface_init(o);
5888         return tag_ptr(res_ptr, true);
5889 }
5890 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
5891         void* this_arg_ptr = untag_ptr(this_arg);
5892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5893         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5894         LDKCVec_TransactionZ txs_constr;
5895         txs_constr.datalen = txs->arr_len;
5896         if (txs_constr.datalen > 0)
5897                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5898         else
5899                 txs_constr.data = NULL;
5900         int8_tArray* txs_vals = (void*) txs->elems;
5901         for (size_t m = 0; m < txs_constr.datalen; m++) {
5902                 int8_tArray txs_conv_12 = txs_vals[m];
5903                 LDKTransaction txs_conv_12_ref;
5904                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
5905                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
5906                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
5907                 txs_conv_12_ref.data_is_owned = true;
5908                 txs_constr.data[m] = txs_conv_12_ref;
5909         }
5910         FREE(txs);
5911         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
5912 }
5913
5914 typedef struct LDKEntropySource_JCalls {
5915         atomic_size_t refcnt;
5916         uint32_t instance_ptr;
5917 } LDKEntropySource_JCalls;
5918 static void LDKEntropySource_JCalls_free(void* this_arg) {
5919         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5920         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5921                 FREE(j_calls);
5922         }
5923 }
5924 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5925         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5926         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5927         LDKThirtyTwoBytes ret_ref;
5928         CHECK(ret->arr_len == 32);
5929         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5930         return ret_ref;
5931 }
5932 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5933         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5934         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5935 }
5936 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5937         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5938         atomic_init(&calls->refcnt, 1);
5939         calls->instance_ptr = o;
5940
5941         LDKEntropySource ret = {
5942                 .this_arg = (void*) calls,
5943                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5944                 .free = LDKEntropySource_JCalls_free,
5945         };
5946         return ret;
5947 }
5948 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5949         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5950         *res_ptr = LDKEntropySource_init(o);
5951         return tag_ptr(res_ptr, true);
5952 }
5953 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5954         void* this_arg_ptr = untag_ptr(this_arg);
5955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5956         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5957         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5958         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5959         return ret_arr;
5960 }
5961
5962 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5963         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5964         switch(obj->tag) {
5965                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5966                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5967                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5968                 default: abort();
5969         }
5970 }
5971 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5972         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5973         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5974         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5975                         uint64_t channel_announcement_ref = 0;
5976                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5977                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5978         return channel_announcement_ref;
5979 }
5980 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5981         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5982         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5983         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5984                         uint64_t channel_update_ref = 0;
5985                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5986                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5987         return channel_update_ref;
5988 }
5989 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5990         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5991         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5992         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5993                         uint64_t node_announcement_ref = 0;
5994                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5995                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5996         return node_announcement_ref;
5997 }
5998 typedef struct LDKNodeSigner_JCalls {
5999         atomic_size_t refcnt;
6000         uint32_t instance_ptr;
6001 } LDKNodeSigner_JCalls;
6002 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6003         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6004         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6005                 FREE(j_calls);
6006         }
6007 }
6008 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6009         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6010         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6011         LDKThirtyTwoBytes ret_ref;
6012         CHECK(ret->arr_len == 32);
6013         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6014         return ret_ref;
6015 }
6016 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6017         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6018         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6019         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6020         void* ret_ptr = untag_ptr(ret);
6021         CHECK_ACCESS(ret_ptr);
6022         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6023         FREE(untag_ptr(ret));
6024         return ret_conv;
6025 }
6026 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6027         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6028         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6029         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6030         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6031         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6032         *tweak_copy = tweak;
6033         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6034         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6035         void* ret_ptr = untag_ptr(ret);
6036         CHECK_ACCESS(ret_ptr);
6037         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6038         FREE(untag_ptr(ret));
6039         return ret_conv;
6040 }
6041 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6042         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6043         LDKu8slice hrp_bytes_var = hrp_bytes;
6044         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6045         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6046         LDKCVec_U5Z invoice_data_var = invoice_data;
6047         ptrArray invoice_data_arr = NULL;
6048         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6049         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6050         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6051                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6052                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6053         }
6054         
6055         FREE(invoice_data_var.data);
6056         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6057         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);
6058         void* ret_ptr = untag_ptr(ret);
6059         CHECK_ACCESS(ret_ptr);
6060         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6061         FREE(untag_ptr(ret));
6062         return ret_conv;
6063 }
6064 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6065         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6066         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6067         uint64_t invoice_request_ref = 0;
6068         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
6069         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6070         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6071         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
6072         void* ret_ptr = untag_ptr(ret);
6073         CHECK_ACCESS(ret_ptr);
6074         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6075         FREE(untag_ptr(ret));
6076         return ret_conv;
6077 }
6078 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6079         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6080         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6081         uint64_t invoice_ref = 0;
6082         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
6083         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6084         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6085         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
6086         void* ret_ptr = untag_ptr(ret);
6087         CHECK_ACCESS(ret_ptr);
6088         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6089         FREE(untag_ptr(ret));
6090         return ret_conv;
6091 }
6092 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6093         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6094         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6095         *msg_copy = msg;
6096         uint64_t msg_ref = tag_ptr(msg_copy, true);
6097         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
6098         void* ret_ptr = untag_ptr(ret);
6099         CHECK_ACCESS(ret_ptr);
6100         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6101         FREE(untag_ptr(ret));
6102         return ret_conv;
6103 }
6104 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6105         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6106         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6107 }
6108 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6109         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6110         atomic_init(&calls->refcnt, 1);
6111         calls->instance_ptr = o;
6112
6113         LDKNodeSigner ret = {
6114                 .this_arg = (void*) calls,
6115                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6116                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6117                 .ecdh = ecdh_LDKNodeSigner_jcall,
6118                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6119                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6120                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6121                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6122                 .free = LDKNodeSigner_JCalls_free,
6123         };
6124         return ret;
6125 }
6126 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6127         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6128         *res_ptr = LDKNodeSigner_init(o);
6129         return tag_ptr(res_ptr, true);
6130 }
6131 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6132         void* this_arg_ptr = untag_ptr(this_arg);
6133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6134         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6135         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6136         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6137         return ret_arr;
6138 }
6139
6140 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6141         void* this_arg_ptr = untag_ptr(this_arg);
6142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6143         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6144         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6145         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6146         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6147         return tag_ptr(ret_conv, true);
6148 }
6149
6150 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) {
6151         void* this_arg_ptr = untag_ptr(this_arg);
6152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6153         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6154         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6155         LDKPublicKey other_key_ref;
6156         CHECK(other_key->arr_len == 33);
6157         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6158         void* tweak_ptr = untag_ptr(tweak);
6159         CHECK_ACCESS(tweak_ptr);
6160         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6161         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6162         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6163         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6164         return tag_ptr(ret_conv, true);
6165 }
6166
6167 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) {
6168         void* this_arg_ptr = untag_ptr(this_arg);
6169         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6170         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6171         LDKu8slice hrp_bytes_ref;
6172         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6173         hrp_bytes_ref.data = hrp_bytes->elems;
6174         LDKCVec_U5Z invoice_data_constr;
6175         invoice_data_constr.datalen = invoice_data->arr_len;
6176         if (invoice_data_constr.datalen > 0)
6177                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6178         else
6179                 invoice_data_constr.data = NULL;
6180         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6181         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6182                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6183                 
6184                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6185         }
6186         FREE(invoice_data);
6187         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6188         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6189         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6190         FREE(hrp_bytes);
6191         return tag_ptr(ret_conv, true);
6192 }
6193
6194 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) {
6195         void* this_arg_ptr = untag_ptr(this_arg);
6196         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6197         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6198         LDKUnsignedInvoiceRequest invoice_request_conv;
6199         invoice_request_conv.inner = untag_ptr(invoice_request);
6200         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6201         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6202         invoice_request_conv.is_owned = false;
6203         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6204         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6205         return tag_ptr(ret_conv, true);
6206 }
6207
6208 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
6209         void* this_arg_ptr = untag_ptr(this_arg);
6210         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6211         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6212         LDKUnsignedBolt12Invoice invoice_conv;
6213         invoice_conv.inner = untag_ptr(invoice);
6214         invoice_conv.is_owned = ptr_is_owned(invoice);
6215         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6216         invoice_conv.is_owned = false;
6217         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6218         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6219         return tag_ptr(ret_conv, true);
6220 }
6221
6222 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6223         void* this_arg_ptr = untag_ptr(this_arg);
6224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6225         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6226         void* msg_ptr = untag_ptr(msg);
6227         CHECK_ACCESS(msg_ptr);
6228         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6229         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6230         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6231         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6232         return tag_ptr(ret_conv, true);
6233 }
6234
6235 typedef struct LDKSignerProvider_JCalls {
6236         atomic_size_t refcnt;
6237         uint32_t instance_ptr;
6238 } LDKSignerProvider_JCalls;
6239 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6240         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6241         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6242                 FREE(j_calls);
6243         }
6244 }
6245 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6246         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6247         jboolean inbound_conv = inbound;
6248         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6249         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6250         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6251         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);
6252         LDKThirtyTwoBytes ret_ref;
6253         CHECK(ret->arr_len == 32);
6254         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6255         return ret_ref;
6256 }
6257 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6258         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6259         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6260         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6261         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6262         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);
6263         void* ret_ptr = untag_ptr(ret);
6264         CHECK_ACCESS(ret_ptr);
6265         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6266         FREE(untag_ptr(ret));
6267         return ret_conv;
6268 }
6269 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6270         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6271         LDKu8slice reader_var = reader;
6272         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6273         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6274         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6275         void* ret_ptr = untag_ptr(ret);
6276         CHECK_ACCESS(ret_ptr);
6277         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6278         FREE(untag_ptr(ret));
6279         return ret_conv;
6280 }
6281 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6282         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6283         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6284         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6285         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0, 0);
6286         void* ret_ptr = untag_ptr(ret);
6287         CHECK_ACCESS(ret_ptr);
6288         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6289         FREE(untag_ptr(ret));
6290         return ret_conv;
6291 }
6292 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6293         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6294         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
6295         void* ret_ptr = untag_ptr(ret);
6296         CHECK_ACCESS(ret_ptr);
6297         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6298         FREE(untag_ptr(ret));
6299         return ret_conv;
6300 }
6301 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6302         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6303         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6304 }
6305 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6306         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6307         atomic_init(&calls->refcnt, 1);
6308         calls->instance_ptr = o;
6309
6310         LDKSignerProvider ret = {
6311                 .this_arg = (void*) calls,
6312                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6313                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6314                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6315                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6316                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6317                 .free = LDKSignerProvider_JCalls_free,
6318         };
6319         return ret;
6320 }
6321 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6322         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6323         *res_ptr = LDKSignerProvider_init(o);
6324         return tag_ptr(res_ptr, true);
6325 }
6326 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) {
6327         void* this_arg_ptr = untag_ptr(this_arg);
6328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6329         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6330         LDKU128 user_channel_id_ref;
6331         CHECK(user_channel_id->arr_len == 16);
6332         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6333         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6334         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);
6335         return ret_arr;
6336 }
6337
6338 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) {
6339         void* this_arg_ptr = untag_ptr(this_arg);
6340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6341         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6342         LDKThirtyTwoBytes channel_keys_id_ref;
6343         CHECK(channel_keys_id->arr_len == 32);
6344         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6345         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6346         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6347         return tag_ptr(ret_ret, true);
6348 }
6349
6350 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6351         void* this_arg_ptr = untag_ptr(this_arg);
6352         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6353         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6354         LDKu8slice reader_ref;
6355         reader_ref.datalen = reader->arr_len;
6356         reader_ref.data = reader->elems;
6357         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6358         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6359         FREE(reader);
6360         return tag_ptr(ret_conv, true);
6361 }
6362
6363 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg, int8_tArray channel_keys_id) {
6364         void* this_arg_ptr = untag_ptr(this_arg);
6365         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6366         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6367         LDKThirtyTwoBytes channel_keys_id_ref;
6368         CHECK(channel_keys_id->arr_len == 32);
6369         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6370         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
6371         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
6372         return tag_ptr(ret_conv, true);
6373 }
6374
6375 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6376         void* this_arg_ptr = untag_ptr(this_arg);
6377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6378         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6379         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
6380         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6381         return tag_ptr(ret_conv, true);
6382 }
6383
6384 typedef struct LDKFeeEstimator_JCalls {
6385         atomic_size_t refcnt;
6386         uint32_t instance_ptr;
6387 } LDKFeeEstimator_JCalls;
6388 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6389         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6390         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6391                 FREE(j_calls);
6392         }
6393 }
6394 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6395         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6396         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6397         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6398 }
6399 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6400         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6401         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6402 }
6403 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6404         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6405         atomic_init(&calls->refcnt, 1);
6406         calls->instance_ptr = o;
6407
6408         LDKFeeEstimator ret = {
6409                 .this_arg = (void*) calls,
6410                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6411                 .free = LDKFeeEstimator_JCalls_free,
6412         };
6413         return ret;
6414 }
6415 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6416         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6417         *res_ptr = LDKFeeEstimator_init(o);
6418         return tag_ptr(res_ptr, true);
6419 }
6420 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) {
6421         void* this_arg_ptr = untag_ptr(this_arg);
6422         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6423         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6424         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6425         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6426         return ret_conv;
6427 }
6428
6429 typedef struct LDKMessageRouter_JCalls {
6430         atomic_size_t refcnt;
6431         uint32_t instance_ptr;
6432 } LDKMessageRouter_JCalls;
6433 static void LDKMessageRouter_JCalls_free(void* this_arg) {
6434         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6435         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6436                 FREE(j_calls);
6437         }
6438 }
6439 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
6440         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6441         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
6442         memcpy(sender_arr->elems, sender.compressed_form, 33);
6443         LDKCVec_PublicKeyZ peers_var = peers;
6444         ptrArray peers_arr = NULL;
6445         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6446         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6447         for (size_t m = 0; m < peers_var.datalen; m++) {
6448                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
6449                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
6450                 peers_arr_ptr[m] = peers_conv_12_arr;
6451         }
6452         
6453         FREE(peers_var.data);
6454         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
6455         *destination_copy = destination;
6456         uint64_t destination_ref = tag_ptr(destination_copy, true);
6457         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 36, (uint32_t)sender_arr, (uint32_t)peers_arr, destination_ref, 0, 0, 0);
6458         void* ret_ptr = untag_ptr(ret);
6459         CHECK_ACCESS(ret_ptr);
6460         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
6461         FREE(untag_ptr(ret));
6462         return ret_conv;
6463 }
6464 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
6465         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6466         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
6467         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
6468         LDKCVec_PublicKeyZ peers_var = peers;
6469         ptrArray peers_arr = NULL;
6470         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6471         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6472         for (size_t m = 0; m < peers_var.datalen; m++) {
6473                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
6474                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
6475                 peers_arr_ptr[m] = peers_conv_12_arr;
6476         }
6477         
6478         FREE(peers_var.data);
6479         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)recipient_arr, (uint32_t)peers_arr, 0, 0, 0, 0);
6480         void* ret_ptr = untag_ptr(ret);
6481         CHECK_ACCESS(ret_ptr);
6482         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
6483         FREE(untag_ptr(ret));
6484         return ret_conv;
6485 }
6486 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
6487         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
6488         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6489 }
6490 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
6491         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
6492         atomic_init(&calls->refcnt, 1);
6493         calls->instance_ptr = o;
6494
6495         LDKMessageRouter ret = {
6496                 .this_arg = (void*) calls,
6497                 .find_path = find_path_LDKMessageRouter_jcall,
6498                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
6499                 .free = LDKMessageRouter_JCalls_free,
6500         };
6501         return ret;
6502 }
6503 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
6504         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
6505         *res_ptr = LDKMessageRouter_init(o);
6506         return tag_ptr(res_ptr, true);
6507 }
6508 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) {
6509         void* this_arg_ptr = untag_ptr(this_arg);
6510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6511         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
6512         LDKPublicKey sender_ref;
6513         CHECK(sender->arr_len == 33);
6514         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
6515         LDKCVec_PublicKeyZ peers_constr;
6516         peers_constr.datalen = peers->arr_len;
6517         if (peers_constr.datalen > 0)
6518                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6519         else
6520                 peers_constr.data = NULL;
6521         int8_tArray* peers_vals = (void*) peers->elems;
6522         for (size_t m = 0; m < peers_constr.datalen; m++) {
6523                 int8_tArray peers_conv_12 = peers_vals[m];
6524                 LDKPublicKey peers_conv_12_ref;
6525                 CHECK(peers_conv_12->arr_len == 33);
6526                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
6527                 peers_constr.data[m] = peers_conv_12_ref;
6528         }
6529         FREE(peers);
6530         void* destination_ptr = untag_ptr(destination);
6531         CHECK_ACCESS(destination_ptr);
6532         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
6533         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
6534         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
6535         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
6536         return tag_ptr(ret_conv, true);
6537 }
6538
6539 uint64_t  __attribute__((export_name("TS_MessageRouter_create_blinded_paths"))) TS_MessageRouter_create_blinded_paths(uint64_t this_arg, int8_tArray recipient, ptrArray peers) {
6540         void* this_arg_ptr = untag_ptr(this_arg);
6541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6542         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
6543         LDKPublicKey recipient_ref;
6544         CHECK(recipient->arr_len == 33);
6545         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
6546         LDKCVec_PublicKeyZ peers_constr;
6547         peers_constr.datalen = peers->arr_len;
6548         if (peers_constr.datalen > 0)
6549                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6550         else
6551                 peers_constr.data = NULL;
6552         int8_tArray* peers_vals = (void*) peers->elems;
6553         for (size_t m = 0; m < peers_constr.datalen; m++) {
6554                 int8_tArray peers_conv_12 = peers_vals[m];
6555                 LDKPublicKey peers_conv_12_ref;
6556                 CHECK(peers_conv_12->arr_len == 33);
6557                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
6558                 peers_constr.data[m] = peers_conv_12_ref;
6559         }
6560         FREE(peers);
6561         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
6562         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
6563         return tag_ptr(ret_conv, true);
6564 }
6565
6566 typedef struct LDKRouter_JCalls {
6567         atomic_size_t refcnt;
6568         uint32_t instance_ptr;
6569         LDKMessageRouter_JCalls* MessageRouter;
6570 } LDKRouter_JCalls;
6571 static void LDKRouter_JCalls_free(void* this_arg) {
6572         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6573         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6574                 FREE(j_calls);
6575         }
6576 }
6577 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
6578         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6579         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6580         memcpy(payer_arr->elems, payer.compressed_form, 33);
6581         LDKRouteParameters route_params_var = *route_params;
6582         uint64_t route_params_ref = 0;
6583         route_params_var = RouteParameters_clone(&route_params_var);
6584         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6585         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6586         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6587         uint64_tArray first_hops_arr = NULL;
6588         if (first_hops != NULL) {
6589                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6590                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6591                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6592                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6593                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6594                         uint64_t first_hops_conv_16_ref = 0;
6595                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6596                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6597                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6598                 }
6599         
6600         }
6601         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6602         uint64_t inflight_htlcs_ref = 0;
6603         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6604         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6605         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 38, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
6606         void* ret_ptr = untag_ptr(ret);
6607         CHECK_ACCESS(ret_ptr);
6608         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6609         FREE(untag_ptr(ret));
6610         return ret_conv;
6611 }
6612 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) {
6613         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6614         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6615         memcpy(payer_arr->elems, payer.compressed_form, 33);
6616         LDKRouteParameters route_params_var = *route_params;
6617         uint64_t route_params_ref = 0;
6618         route_params_var = RouteParameters_clone(&route_params_var);
6619         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6620         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6621         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6622         uint64_tArray first_hops_arr = NULL;
6623         if (first_hops != NULL) {
6624                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6625                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6626                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6627                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6628                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6629                         uint64_t first_hops_conv_16_ref = 0;
6630                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6631                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6632                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6633                 }
6634         
6635         }
6636         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6637         uint64_t inflight_htlcs_ref = 0;
6638         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6639         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6640         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6641         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6642         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6643         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6644         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 39, (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);
6645         void* ret_ptr = untag_ptr(ret);
6646         CHECK_ACCESS(ret_ptr);
6647         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6648         FREE(untag_ptr(ret));
6649         return ret_conv;
6650 }
6651 LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ create_blinded_payment_paths_LDKRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_ChannelDetailsZ first_hops, LDKReceiveTlvs tlvs, uint64_t amount_msats) {
6652         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6653         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
6654         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
6655         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
6656         uint64_tArray first_hops_arr = NULL;
6657         first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6658         uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6659         for (size_t q = 0; q < first_hops_var.datalen; q++) {
6660                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
6661                 uint64_t first_hops_conv_16_ref = 0;
6662                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6663                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6664                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6665         }
6666         
6667         FREE(first_hops_var.data);
6668         LDKReceiveTlvs tlvs_var = tlvs;
6669         uint64_t tlvs_ref = 0;
6670         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
6671         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
6672         int64_t amount_msats_conv = amount_msats;
6673         uint64_t ret = js_invoke_function_uubbuu(j_calls->instance_ptr, 40, (uint32_t)recipient_arr, (uint32_t)first_hops_arr, tlvs_ref, amount_msats_conv, 0, 0);
6674         void* ret_ptr = untag_ptr(ret);
6675         CHECK_ACCESS(ret_ptr);
6676         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
6677         FREE(untag_ptr(ret));
6678         return ret_conv;
6679 }
6680 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6681         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6682         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6683         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
6684 }
6685 static inline LDKRouter LDKRouter_init (JSValue o, JSValue MessageRouter) {
6686         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6687         atomic_init(&calls->refcnt, 1);
6688         calls->instance_ptr = o;
6689
6690         LDKRouter ret = {
6691                 .this_arg = (void*) calls,
6692                 .find_route = find_route_LDKRouter_jcall,
6693                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6694                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
6695                 .free = LDKRouter_JCalls_free,
6696                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
6697         };
6698         calls->MessageRouter = ret.MessageRouter.this_arg;
6699         return ret;
6700 }
6701 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o, JSValue MessageRouter) {
6702         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6703         *res_ptr = LDKRouter_init(o, MessageRouter);
6704         return tag_ptr(res_ptr, true);
6705 }
6706 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) {
6707         void* this_arg_ptr = untag_ptr(this_arg);
6708         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6709         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6710         LDKPublicKey payer_ref;
6711         CHECK(payer->arr_len == 33);
6712         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6713         LDKRouteParameters route_params_conv;
6714         route_params_conv.inner = untag_ptr(route_params);
6715         route_params_conv.is_owned = ptr_is_owned(route_params);
6716         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6717         route_params_conv.is_owned = false;
6718         LDKCVec_ChannelDetailsZ first_hops_constr;
6719         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6720         if (first_hops != 0) {
6721                 first_hops_constr.datalen = first_hops->arr_len;
6722                 if (first_hops_constr.datalen > 0)
6723                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6724                 else
6725                         first_hops_constr.data = NULL;
6726                 uint64_t* first_hops_vals = first_hops->elems;
6727                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6728                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6729                         LDKChannelDetails first_hops_conv_16_conv;
6730                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6731                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6732                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6733                         first_hops_conv_16_conv.is_owned = false;
6734                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6735                 }
6736                 FREE(first_hops);
6737                 first_hops_ptr = &first_hops_constr;
6738         }
6739         LDKInFlightHtlcs inflight_htlcs_conv;
6740         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6741         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6742         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6743         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6744         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6745         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
6746         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6747         return tag_ptr(ret_conv, true);
6748 }
6749
6750 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) {
6751         void* this_arg_ptr = untag_ptr(this_arg);
6752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6753         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6754         LDKPublicKey payer_ref;
6755         CHECK(payer->arr_len == 33);
6756         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6757         LDKRouteParameters route_params_conv;
6758         route_params_conv.inner = untag_ptr(route_params);
6759         route_params_conv.is_owned = ptr_is_owned(route_params);
6760         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6761         route_params_conv.is_owned = false;
6762         LDKCVec_ChannelDetailsZ first_hops_constr;
6763         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6764         if (first_hops != 0) {
6765                 first_hops_constr.datalen = first_hops->arr_len;
6766                 if (first_hops_constr.datalen > 0)
6767                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6768                 else
6769                         first_hops_constr.data = NULL;
6770                 uint64_t* first_hops_vals = first_hops->elems;
6771                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6772                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6773                         LDKChannelDetails first_hops_conv_16_conv;
6774                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6775                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6776                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6777                         first_hops_conv_16_conv.is_owned = false;
6778                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6779                 }
6780                 FREE(first_hops);
6781                 first_hops_ptr = &first_hops_constr;
6782         }
6783         LDKInFlightHtlcs inflight_htlcs_conv;
6784         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6785         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6786         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6787         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6788         LDKThirtyTwoBytes _payment_hash_ref;
6789         CHECK(_payment_hash->arr_len == 32);
6790         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6791         LDKThirtyTwoBytes _payment_id_ref;
6792         CHECK(_payment_id->arr_len == 32);
6793         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6794         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6795         *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);
6796         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6797         return tag_ptr(ret_conv, true);
6798 }
6799
6800 uint64_t  __attribute__((export_name("TS_Router_create_blinded_payment_paths"))) TS_Router_create_blinded_payment_paths(uint64_t this_arg, int8_tArray recipient, uint64_tArray first_hops, uint64_t tlvs, int64_t amount_msats) {
6801         void* this_arg_ptr = untag_ptr(this_arg);
6802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6803         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6804         LDKPublicKey recipient_ref;
6805         CHECK(recipient->arr_len == 33);
6806         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
6807         LDKCVec_ChannelDetailsZ first_hops_constr;
6808         first_hops_constr.datalen = first_hops->arr_len;
6809         if (first_hops_constr.datalen > 0)
6810                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6811         else
6812                 first_hops_constr.data = NULL;
6813         uint64_t* first_hops_vals = first_hops->elems;
6814         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6815                 uint64_t first_hops_conv_16 = first_hops_vals[q];
6816                 LDKChannelDetails first_hops_conv_16_conv;
6817                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6818                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6819                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6820                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
6821                 first_hops_constr.data[q] = first_hops_conv_16_conv;
6822         }
6823         FREE(first_hops);
6824         LDKReceiveTlvs tlvs_conv;
6825         tlvs_conv.inner = untag_ptr(tlvs);
6826         tlvs_conv.is_owned = ptr_is_owned(tlvs);
6827         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
6828         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
6829         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
6830         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
6831         return tag_ptr(ret_conv, true);
6832 }
6833
6834 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6835         return ThirtyTwoBytes_clone(&owner->a);
6836 }
6837 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
6838         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6840         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
6841         return ret_arr;
6842 }
6843
6844 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6845         LDKChannelManager ret = owner->b;
6846         ret.is_owned = false;
6847         return ret;
6848 }
6849 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
6850         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6851         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
6852         uint64_t ret_ref = 0;
6853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6855         return ret_ref;
6856 }
6857
6858 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6859 CHECK(owner->result_ok);
6860         return &*owner->contents.result;
6861 }
6862 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6863         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6864         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6865         return ret_ret;
6866 }
6867
6868 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6869 CHECK(!owner->result_ok);
6870         return DecodeError_clone(&*owner->contents.err);
6871 }
6872 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6873         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6874         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6875         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
6876         uint64_t ret_ref = tag_ptr(ret_copy, true);
6877         return ret_ref;
6878 }
6879
6880 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
6881         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6882         switch(obj->tag) {
6883                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
6884                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
6885                 default: abort();
6886         }
6887 }
6888 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
6889         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6890         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
6891         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
6892         return fixed_limit_msat_conv;
6893 }
6894 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
6895         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6896         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
6897         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
6898         return fee_rate_multiplier_conv;
6899 }
6900 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6901 CHECK(owner->result_ok);
6902         return MaxDustHTLCExposure_clone(&*owner->contents.result);
6903 }
6904 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
6905         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6906         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
6907         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
6908         uint64_t ret_ref = tag_ptr(ret_copy, true);
6909         return ret_ref;
6910 }
6911
6912 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6913 CHECK(!owner->result_ok);
6914         return DecodeError_clone(&*owner->contents.err);
6915 }
6916 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
6917         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6918         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6919         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
6920         uint64_t ret_ref = tag_ptr(ret_copy, true);
6921         return ret_ref;
6922 }
6923
6924 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6925         LDKChannelConfig ret = *owner->contents.result;
6926         ret.is_owned = false;
6927         return ret;
6928 }
6929 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6930         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6931         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6932         uint64_t ret_ref = 0;
6933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6935         return ret_ref;
6936 }
6937
6938 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6939 CHECK(!owner->result_ok);
6940         return DecodeError_clone(&*owner->contents.err);
6941 }
6942 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6943         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6944         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6945         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6946         uint64_t ret_ref = tag_ptr(ret_copy, true);
6947         return ret_ref;
6948 }
6949
6950 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
6951         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6952         switch(obj->tag) {
6953                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
6954                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
6955                 default: abort();
6956         }
6957 }
6958 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
6959         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6960         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
6961         uint64_t some_ref = tag_ptr(&obj->some, false);
6962         return some_ref;
6963 }
6964 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6965         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6966         switch(obj->tag) {
6967                 case LDKCOption_APIErrorZ_Some: return 0;
6968                 case LDKCOption_APIErrorZ_None: return 1;
6969                 default: abort();
6970         }
6971 }
6972 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6973         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6974         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6975         uint64_t some_ref = tag_ptr(&obj->some, false);
6976         return some_ref;
6977 }
6978 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6979 CHECK(owner->result_ok);
6980         return COption_APIErrorZ_clone(&*owner->contents.result);
6981 }
6982 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6983         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6984         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6985         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6986         uint64_t ret_ref = tag_ptr(ret_copy, true);
6987         return ret_ref;
6988 }
6989
6990 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6991 CHECK(!owner->result_ok);
6992         return DecodeError_clone(&*owner->contents.err);
6993 }
6994 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6995         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6996         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6997         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6998         uint64_t ret_ref = tag_ptr(ret_copy, true);
6999         return ret_ref;
7000 }
7001
7002 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7003         LDKChannelMonitorUpdate ret = *owner->contents.result;
7004         ret.is_owned = false;
7005         return ret;
7006 }
7007 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7008         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7009         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7010         uint64_t ret_ref = 0;
7011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7013         return ret_ref;
7014 }
7015
7016 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7017 CHECK(!owner->result_ok);
7018         return DecodeError_clone(&*owner->contents.err);
7019 }
7020 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7021         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7022         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7023         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7024         uint64_t ret_ref = tag_ptr(ret_copy, true);
7025         return ret_ref;
7026 }
7027
7028 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7029         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7030         switch(obj->tag) {
7031                 case LDKCOption_MonitorEventZ_Some: return 0;
7032                 case LDKCOption_MonitorEventZ_None: return 1;
7033                 default: abort();
7034         }
7035 }
7036 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7037         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7038         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7039         uint64_t some_ref = tag_ptr(&obj->some, false);
7040         return some_ref;
7041 }
7042 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7043 CHECK(owner->result_ok);
7044         return COption_MonitorEventZ_clone(&*owner->contents.result);
7045 }
7046 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7047         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7048         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7049         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7050         uint64_t ret_ref = tag_ptr(ret_copy, true);
7051         return ret_ref;
7052 }
7053
7054 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7055 CHECK(!owner->result_ok);
7056         return DecodeError_clone(&*owner->contents.err);
7057 }
7058 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7059         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7060         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7061         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7062         uint64_t ret_ref = tag_ptr(ret_copy, true);
7063         return ret_ref;
7064 }
7065
7066 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7067         LDKHTLCUpdate ret = *owner->contents.result;
7068         ret.is_owned = false;
7069         return ret;
7070 }
7071 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7072         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7073         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7074         uint64_t ret_ref = 0;
7075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7077         return ret_ref;
7078 }
7079
7080 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7081 CHECK(!owner->result_ok);
7082         return DecodeError_clone(&*owner->contents.err);
7083 }
7084 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7085         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7086         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7087         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7088         uint64_t ret_ref = tag_ptr(ret_copy, true);
7089         return ret_ref;
7090 }
7091
7092 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7093         LDKOutPoint ret = owner->a;
7094         ret.is_owned = false;
7095         return ret;
7096 }
7097 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
7098         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7099         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7100         uint64_t ret_ref = 0;
7101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7103         return ret_ref;
7104 }
7105
7106 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7107         return CVec_u8Z_clone(&owner->b);
7108 }
7109 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
7110         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7111         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7112         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7113         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7114         CVec_u8Z_free(ret_var);
7115         return ret_arr;
7116 }
7117
7118 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7119         return owner->a;
7120 }
7121 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
7122         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7123         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7124         return ret_conv;
7125 }
7126
7127 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7128         return CVec_u8Z_clone(&owner->b);
7129 }
7130 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
7131         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7132         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7135         CVec_u8Z_free(ret_var);
7136         return ret_arr;
7137 }
7138
7139 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7140         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7141         for (size_t i = 0; i < ret.datalen; i++) {
7142                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7143         }
7144         return ret;
7145 }
7146 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7147         return ThirtyTwoBytes_clone(&owner->a);
7148 }
7149 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
7150         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7151         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7152         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7153         return ret_arr;
7154 }
7155
7156 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7157         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7158 }
7159 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
7160         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7161         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7162         uint64_tArray ret_arr = NULL;
7163         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7164         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7165         for (size_t x = 0; x < ret_var.datalen; x++) {
7166                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7167                 *ret_conv_23_conv = ret_var.data[x];
7168                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7169         }
7170         
7171         FREE(ret_var.data);
7172         return ret_arr;
7173 }
7174
7175 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7176         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 };
7177         for (size_t i = 0; i < ret.datalen; i++) {
7178                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7179         }
7180         return ret;
7181 }
7182 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7183         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7184         for (size_t i = 0; i < ret.datalen; i++) {
7185                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7186         }
7187         return ret;
7188 }
7189 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7190         return owner->a;
7191 }
7192 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
7193         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7194         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7195         return ret_conv;
7196 }
7197
7198 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7199         return TxOut_clone(&owner->b);
7200 }
7201 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
7202         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7203         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7204         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7205         return tag_ptr(ret_ref, true);
7206 }
7207
7208 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7209         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7210         for (size_t i = 0; i < ret.datalen; i++) {
7211                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7212         }
7213         return ret;
7214 }
7215 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7216         return ThirtyTwoBytes_clone(&owner->a);
7217 }
7218 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
7219         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7220         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7221         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7222         return ret_arr;
7223 }
7224
7225 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7226         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7227 }
7228 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
7229         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7230         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7231         uint64_tArray ret_arr = NULL;
7232         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7233         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7234         for (size_t u = 0; u < ret_var.datalen; u++) {
7235                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7236                 *ret_conv_20_conv = ret_var.data[u];
7237                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7238         }
7239         
7240         FREE(ret_var.data);
7241         return ret_arr;
7242 }
7243
7244 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7245         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 };
7246         for (size_t i = 0; i < ret.datalen; i++) {
7247                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7248         }
7249         return ret;
7250 }
7251 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
7252         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7253         switch(obj->tag) {
7254                 case LDKBalance_ClaimableOnChannelClose: return 0;
7255                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7256                 case LDKBalance_ContentiousClaimable: return 2;
7257                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7258                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7259                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7260                 default: abort();
7261         }
7262 }
7263 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
7264         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7265         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
7266         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7267         return amount_satoshis_conv;
7268 }
7269 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
7270         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7271         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7272         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7273         return amount_satoshis_conv;
7274 }
7275 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7276         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7277         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7278         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7279         return confirmation_height_conv;
7280 }
7281 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
7282         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7283         assert(obj->tag == LDKBalance_ContentiousClaimable);
7284         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7285         return amount_satoshis_conv;
7286 }
7287 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7288         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7289         assert(obj->tag == LDKBalance_ContentiousClaimable);
7290         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7291         return timeout_height_conv;
7292 }
7293 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
7294         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7295         assert(obj->tag == LDKBalance_ContentiousClaimable);
7296         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7297         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7298         return payment_hash_arr;
7299 }
7300 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
7301         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7302         assert(obj->tag == LDKBalance_ContentiousClaimable);
7303         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7304         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7305         return payment_preimage_arr;
7306 }
7307 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7308         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7309         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7310         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7311         return amount_satoshis_conv;
7312 }
7313 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7314         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7315         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7316         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7317         return claimable_height_conv;
7318 }
7319 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
7320         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7321         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7322         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7323         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7324         return payment_hash_arr;
7325 }
7326 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7327         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7328         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7329         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7330         return amount_satoshis_conv;
7331 }
7332 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7333         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7334         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7335         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7336         return expiry_height_conv;
7337 }
7338 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
7339         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7340         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7341         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7342         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7343         return payment_hash_arr;
7344 }
7345 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
7346         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7347         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7348         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7349         return amount_satoshis_conv;
7350 }
7351 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7352         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7353         for (size_t i = 0; i < ret.datalen; i++) {
7354                 ret.data[i] = Balance_clone(&orig->data[i]);
7355         }
7356         return ret;
7357 }
7358 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7359         return ThirtyTwoBytes_clone(&owner->a);
7360 }
7361 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
7362         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7363         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7364         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
7365         return ret_arr;
7366 }
7367
7368 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7369         LDKChannelMonitor ret = owner->b;
7370         ret.is_owned = false;
7371         return ret;
7372 }
7373 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
7374         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7375         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
7376         uint64_t ret_ref = 0;
7377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7379         return ret_ref;
7380 }
7381
7382 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7383 CHECK(owner->result_ok);
7384         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7385 }
7386 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7387         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7388         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7389         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7390         return tag_ptr(ret_conv, true);
7391 }
7392
7393 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7394 CHECK(!owner->result_ok);
7395         return DecodeError_clone(&*owner->contents.err);
7396 }
7397 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7398         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7400         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7401         uint64_t ret_ref = tag_ptr(ret_copy, true);
7402         return ret_ref;
7403 }
7404
7405 typedef struct LDKType_JCalls {
7406         atomic_size_t refcnt;
7407         uint32_t instance_ptr;
7408 } LDKType_JCalls;
7409 static void LDKType_JCalls_free(void* this_arg) {
7410         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7411         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7412                 FREE(j_calls);
7413         }
7414 }
7415 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7416         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7417         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
7418 }
7419 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7420         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7421         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7422         LDKStr ret_conv = str_ref_to_owned_c(ret);
7423         return ret_conv;
7424 }
7425 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7426         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7427         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, 0, 0, 0, 0, 0, 0);
7428         LDKCVec_u8Z ret_ref;
7429         ret_ref.datalen = ret->arr_len;
7430         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7431         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7432         return ret_ref;
7433 }
7434 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7435         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7436         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7437 }
7438 static inline LDKType LDKType_init (JSValue o) {
7439         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7440         atomic_init(&calls->refcnt, 1);
7441         calls->instance_ptr = o;
7442
7443         LDKType ret = {
7444                 .this_arg = (void*) calls,
7445                 .type_id = type_id_LDKType_jcall,
7446                 .debug_str = debug_str_LDKType_jcall,
7447                 .write = write_LDKType_jcall,
7448                 .cloned = LDKType_JCalls_cloned,
7449                 .free = LDKType_JCalls_free,
7450         };
7451         return ret;
7452 }
7453 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
7454         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7455         *res_ptr = LDKType_init(o);
7456         return tag_ptr(res_ptr, true);
7457 }
7458 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
7459         void* this_arg_ptr = untag_ptr(this_arg);
7460         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7461         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7462         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7463         return ret_conv;
7464 }
7465
7466 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
7467         void* this_arg_ptr = untag_ptr(this_arg);
7468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7469         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7470         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7471         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7472         Str_free(ret_str);
7473         return ret_conv;
7474 }
7475
7476 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
7477         void* this_arg_ptr = untag_ptr(this_arg);
7478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7479         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7480         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7481         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7482         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7483         CVec_u8Z_free(ret_var);
7484         return ret_arr;
7485 }
7486
7487 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7488         return owner->a;
7489 }
7490 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
7491         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7492         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7493         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
7494         return ret_arr;
7495 }
7496
7497 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7498         return Type_clone(&owner->b);
7499 }
7500 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
7501         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7502         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7503         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7504         return tag_ptr(ret_ret, true);
7505 }
7506
7507 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7508         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7509         for (size_t i = 0; i < ret.datalen; i++) {
7510                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7511         }
7512         return ret;
7513 }
7514 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
7515         return owner->a;
7516 }
7517 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(uint64_t owner) {
7518         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
7519         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7520         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7521         return ret_arr;
7522 }
7523
7524 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
7525         return CVec_SocketAddressZ_clone(&owner->b);
7526 }
7527 uint64_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(uint64_t owner) {
7528         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
7529         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
7530         uint64_tArray ret_arr = NULL;
7531         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7532         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7533         for (size_t p = 0; p < ret_var.datalen; p++) {
7534                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7535                 *ret_conv_15_copy = ret_var.data[p];
7536                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
7537                 ret_arr_ptr[p] = ret_conv_15_ref;
7538         }
7539         
7540         FREE(ret_var.data);
7541         return ret_arr;
7542 }
7543
7544 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
7545         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
7546         for (size_t i = 0; i < ret.datalen; i++) {
7547                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
7548         }
7549         return ret;
7550 }
7551 typedef struct LDKOnionMessageContents_JCalls {
7552         atomic_size_t refcnt;
7553         uint32_t instance_ptr;
7554 } LDKOnionMessageContents_JCalls;
7555 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
7556         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7557         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7558                 FREE(j_calls);
7559         }
7560 }
7561 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
7562         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7563         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
7564 }
7565 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
7566         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7567         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
7568         LDKCVec_u8Z ret_ref;
7569         ret_ref.datalen = ret->arr_len;
7570         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7571         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7572         return ret_ref;
7573 }
7574 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
7575         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7576         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
7577         LDKStr ret_conv = str_ref_to_owned_c(ret);
7578         return ret_conv;
7579 }
7580 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
7581         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
7582         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7583 }
7584 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
7585         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
7586         atomic_init(&calls->refcnt, 1);
7587         calls->instance_ptr = o;
7588
7589         LDKOnionMessageContents ret = {
7590                 .this_arg = (void*) calls,
7591                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
7592                 .write = write_LDKOnionMessageContents_jcall,
7593                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
7594                 .cloned = LDKOnionMessageContents_JCalls_cloned,
7595                 .free = LDKOnionMessageContents_JCalls_free,
7596         };
7597         return ret;
7598 }
7599 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
7600         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7601         *res_ptr = LDKOnionMessageContents_init(o);
7602         return tag_ptr(res_ptr, true);
7603 }
7604 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
7605         void* this_arg_ptr = untag_ptr(this_arg);
7606         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7607         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
7608         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
7609         return ret_conv;
7610 }
7611
7612 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
7613         void* this_arg_ptr = untag_ptr(this_arg);
7614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7615         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
7616         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7617         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7618         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7619         CVec_u8Z_free(ret_var);
7620         return ret_arr;
7621 }
7622
7623 jstring  __attribute__((export_name("TS_OnionMessageContents_debug_str"))) TS_OnionMessageContents_debug_str(uint64_t this_arg) {
7624         void* this_arg_ptr = untag_ptr(this_arg);
7625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7626         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
7627         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7628         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7629         Str_free(ret_str);
7630         return ret_conv;
7631 }
7632
7633 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
7634         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
7635         switch(obj->tag) {
7636                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
7637                 case LDKCOption_OnionMessageContentsZ_None: return 1;
7638                 default: abort();
7639         }
7640 }
7641 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
7642         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
7643         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
7644         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7645         *some_ret = OnionMessageContents_clone(&obj->some);
7646         return tag_ptr(some_ret, true);
7647 }
7648 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7649 CHECK(owner->result_ok);
7650         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
7651 }
7652 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7653         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7654         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
7655         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7656         uint64_t ret_ref = tag_ptr(ret_copy, true);
7657         return ret_ref;
7658 }
7659
7660 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7661 CHECK(!owner->result_ok);
7662         return DecodeError_clone(&*owner->contents.err);
7663 }
7664 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7665         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7667         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7668         uint64_t ret_ref = tag_ptr(ret_copy, true);
7669         return ret_ref;
7670 }
7671
7672 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7673         return OnionMessageContents_clone(&owner->a);
7674 }
7675 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
7676         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7677         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7678         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
7679         return tag_ptr(ret_ret, true);
7680 }
7681
7682 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7683         return Destination_clone(&owner->b);
7684 }
7685 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
7686         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7687         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7688         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
7689         uint64_t ret_ref = tag_ptr(ret_copy, true);
7690         return ret_ref;
7691 }
7692
7693 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7694         LDKBlindedPath ret = owner->c;
7695         ret.is_owned = false;
7696         return ret;
7697 }
7698 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
7699         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7700         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
7701         uint64_t ret_ref = 0;
7702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7704         return ret_ref;
7705 }
7706
7707 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
7708         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7709         for (size_t i = 0; i < ret.datalen; i++) {
7710                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
7711         }
7712         return ret;
7713 }
7714 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
7715         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7716         switch(obj->tag) {
7717                 case LDKCOption_TypeZ_Some: return 0;
7718                 case LDKCOption_TypeZ_None: return 1;
7719                 default: abort();
7720         }
7721 }
7722 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
7723         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7724         assert(obj->tag == LDKCOption_TypeZ_Some);
7725         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7726         *some_ret = Type_clone(&obj->some);
7727         return tag_ptr(some_ret, true);
7728 }
7729 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7730 CHECK(owner->result_ok);
7731         return COption_TypeZ_clone(&*owner->contents.result);
7732 }
7733 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
7734         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7735         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7736         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7737         uint64_t ret_ref = tag_ptr(ret_copy, true);
7738         return ret_ref;
7739 }
7740
7741 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7742 CHECK(!owner->result_ok);
7743         return DecodeError_clone(&*owner->contents.err);
7744 }
7745 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
7746         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7747         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7748         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7749         uint64_t ret_ref = tag_ptr(ret_copy, true);
7750         return ret_ref;
7751 }
7752
7753 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
7754         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7755         switch(obj->tag) {
7756                 case LDKCOption_SocketAddressZ_Some: return 0;
7757                 case LDKCOption_SocketAddressZ_None: return 1;
7758                 default: abort();
7759         }
7760 }
7761 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
7762         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7763         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
7764         uint64_t some_ref = tag_ptr(&obj->some, false);
7765         return some_ref;
7766 }
7767 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7768         return owner->a;
7769 }
7770 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(uint64_t owner) {
7771         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7772         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7773         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7774         return ret_arr;
7775 }
7776
7777 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7778         return COption_SocketAddressZ_clone(&owner->b);
7779 }
7780 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(uint64_t owner) {
7781         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7782         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
7783         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
7784         uint64_t ret_ref = tag_ptr(ret_copy, true);
7785         return ret_ref;
7786 }
7787
7788 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
7789         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
7790         for (size_t i = 0; i < ret.datalen; i++) {
7791                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
7792         }
7793         return ret;
7794 }
7795 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7796 CHECK(owner->result_ok);
7797         return CVec_u8Z_clone(&*owner->contents.result);
7798 }
7799 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7800         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7801         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7802         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7803         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7804         CVec_u8Z_free(ret_var);
7805         return ret_arr;
7806 }
7807
7808 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7809         LDKPeerHandleError ret = *owner->contents.err;
7810         ret.is_owned = false;
7811         return ret;
7812 }
7813 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7814         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7815         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7816         uint64_t ret_ref = 0;
7817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7819         return ret_ref;
7820 }
7821
7822 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7823 CHECK(owner->result_ok);
7824         return *owner->contents.result;
7825 }
7826 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7827         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7828         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7829 }
7830
7831 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7832         LDKPeerHandleError ret = *owner->contents.err;
7833         ret.is_owned = false;
7834         return ret;
7835 }
7836 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7837         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7838         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7839         uint64_t ret_ref = 0;
7840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7842         return ret_ref;
7843 }
7844
7845 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7846 CHECK(owner->result_ok);
7847         return *owner->contents.result;
7848 }
7849 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7850         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7851         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7852         return ret_conv;
7853 }
7854
7855 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7856         LDKPeerHandleError ret = *owner->contents.err;
7857         ret.is_owned = false;
7858         return ret;
7859 }
7860 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7861         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7862         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7863         uint64_t ret_ref = 0;
7864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7866         return ret_ref;
7867 }
7868
7869 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7870         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7871         switch(obj->tag) {
7872                 case LDKGraphSyncError_DecodeError: return 0;
7873                 case LDKGraphSyncError_LightningError: return 1;
7874                 default: abort();
7875         }
7876 }
7877 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7878         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7879         assert(obj->tag == LDKGraphSyncError_DecodeError);
7880         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7881         return decode_error_ref;
7882 }
7883 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7884         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7885         assert(obj->tag == LDKGraphSyncError_LightningError);
7886         LDKLightningError lightning_error_var = obj->lightning_error;
7887                         uint64_t lightning_error_ref = 0;
7888                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7889                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7890         return lightning_error_ref;
7891 }
7892 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7893 CHECK(owner->result_ok);
7894         return *owner->contents.result;
7895 }
7896 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7897         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7898         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7899         return ret_conv;
7900 }
7901
7902 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7903 CHECK(!owner->result_ok);
7904         return GraphSyncError_clone(&*owner->contents.err);
7905 }
7906 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7907         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7908         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7909         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7910         uint64_t ret_ref = tag_ptr(ret_copy, true);
7911         return ret_ref;
7912 }
7913
7914 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7915 CHECK(owner->result_ok);
7916         return CVec_u8Z_clone(&*owner->contents.result);
7917 }
7918 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
7919         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7920         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
7921         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7922         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7923         CVec_u8Z_free(ret_var);
7924         return ret_arr;
7925 }
7926
7927 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7928 CHECK(!owner->result_ok);
7929         return *owner->contents.err;
7930 }
7931 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
7932         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7933         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
7934         return ret_conv;
7935 }
7936
7937 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7938 CHECK(owner->result_ok);
7939         return *owner->contents.result;
7940 }
7941 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
7942         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7943         CResult_NoneIOErrorZ_get_ok(owner_conv);
7944 }
7945
7946 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7947 CHECK(!owner->result_ok);
7948         return *owner->contents.err;
7949 }
7950 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
7951         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7952         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
7953         return ret_conv;
7954 }
7955
7956 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7957 CHECK(owner->result_ok);
7958         return *owner->contents.result;
7959 }
7960 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
7961         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7962         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
7963         ptrArray ret_arr = NULL;
7964         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
7965         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
7966         for (size_t i = 0; i < ret_var.datalen; i++) {
7967                 LDKStr ret_conv_8_str = ret_var.data[i];
7968                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
7969                 ret_arr_ptr[i] = ret_conv_8_conv;
7970         }
7971         
7972         return ret_arr;
7973 }
7974
7975 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7976 CHECK(!owner->result_ok);
7977         return *owner->contents.err;
7978 }
7979 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
7980         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7981         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
7982         return ret_conv;
7983 }
7984
7985 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
7986         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
7987         for (size_t i = 0; i < ret.datalen; i++) {
7988                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
7989         }
7990         return ret;
7991 }
7992 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7993 CHECK(owner->result_ok);
7994         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
7995 }
7996 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
7997         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7998         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
7999         uint64_tArray ret_arr = NULL;
8000         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8001         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8002         for (size_t o = 0; o < ret_var.datalen; o++) {
8003                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8004                 *ret_conv_40_conv = ret_var.data[o];
8005                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8006         }
8007         
8008         FREE(ret_var.data);
8009         return ret_arr;
8010 }
8011
8012 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8013 CHECK(!owner->result_ok);
8014         return *owner->contents.err;
8015 }
8016 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
8017         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8018         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8019         return ret_conv;
8020 }
8021
8022 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8023 CHECK(owner->result_ok);
8024         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8025 }
8026 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
8027         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8028         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8029         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8030         return tag_ptr(ret_conv, true);
8031 }
8032
8033 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8034 CHECK(!owner->result_ok);
8035         return *owner->contents.err;
8036 }
8037 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
8038         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8039         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8040         return ret_conv;
8041 }
8042
8043 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
8044         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8045         switch(obj->tag) {
8046                 case LDKCOption_SecretKeyZ_Some: return 0;
8047                 case LDKCOption_SecretKeyZ_None: return 1;
8048                 default: abort();
8049         }
8050 }
8051 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
8052         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8053         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
8054         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8055         memcpy(some_arr->elems, obj->some.bytes, 32);
8056         return some_arr;
8057 }
8058 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8059         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8060         ret.is_owned = false;
8061         return ret;
8062 }
8063 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
8064         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8065         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8066         uint64_t ret_ref = 0;
8067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8069         return ret_ref;
8070 }
8071
8072 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8073 CHECK(!owner->result_ok);
8074         return *owner->contents.err;
8075 }
8076 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
8077         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8078         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8079 }
8080
8081 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8082         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8083         for (size_t i = 0; i < ret.datalen; i++) {
8084                 ret.data[i] = Witness_clone(&orig->data[i]);
8085         }
8086         return ret;
8087 }
8088 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8089         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8090         switch(obj->tag) {
8091                 case LDKCOption_i64Z_Some: return 0;
8092                 case LDKCOption_i64Z_None: return 1;
8093                 default: abort();
8094         }
8095 }
8096 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8097         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8098         assert(obj->tag == LDKCOption_i64Z_Some);
8099         int64_t some_conv = obj->some;
8100         return some_conv;
8101 }
8102 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8103 CHECK(owner->result_ok);
8104         return SocketAddress_clone(&*owner->contents.result);
8105 }
8106 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
8107         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8108         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8109         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8110         uint64_t ret_ref = tag_ptr(ret_copy, true);
8111         return ret_ref;
8112 }
8113
8114 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8115 CHECK(!owner->result_ok);
8116         return DecodeError_clone(&*owner->contents.err);
8117 }
8118 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
8119         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8121         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8122         uint64_t ret_ref = tag_ptr(ret_copy, true);
8123         return ret_ref;
8124 }
8125
8126 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8127 CHECK(owner->result_ok);
8128         return SocketAddress_clone(&*owner->contents.result);
8129 }
8130 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
8131         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8132         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8133         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8134         uint64_t ret_ref = tag_ptr(ret_copy, true);
8135         return ret_ref;
8136 }
8137
8138 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8139 CHECK(!owner->result_ok);
8140         return SocketAddressParseError_clone(&*owner->contents.err);
8141 }
8142 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
8143         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8144         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8145         return ret_conv;
8146 }
8147
8148 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8149         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8150         for (size_t i = 0; i < ret.datalen; i++) {
8151                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8152         }
8153         return ret;
8154 }
8155 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8156         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8157         for (size_t i = 0; i < ret.datalen; i++) {
8158                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8159         }
8160         return ret;
8161 }
8162 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8163         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8164         for (size_t i = 0; i < ret.datalen; i++) {
8165                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8166         }
8167         return ret;
8168 }
8169 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8170         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8171         for (size_t i = 0; i < ret.datalen; i++) {
8172                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8173         }
8174         return ret;
8175 }
8176 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8177         LDKAcceptChannel ret = *owner->contents.result;
8178         ret.is_owned = false;
8179         return ret;
8180 }
8181 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8182         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8183         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8184         uint64_t ret_ref = 0;
8185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8187         return ret_ref;
8188 }
8189
8190 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8191 CHECK(!owner->result_ok);
8192         return DecodeError_clone(&*owner->contents.err);
8193 }
8194 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8195         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8197         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8198         uint64_t ret_ref = tag_ptr(ret_copy, true);
8199         return ret_ref;
8200 }
8201
8202 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8203         LDKAcceptChannelV2 ret = *owner->contents.result;
8204         ret.is_owned = false;
8205         return ret;
8206 }
8207 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8208         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8209         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8210         uint64_t ret_ref = 0;
8211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8213         return ret_ref;
8214 }
8215
8216 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8217 CHECK(!owner->result_ok);
8218         return DecodeError_clone(&*owner->contents.err);
8219 }
8220 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8221         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8222         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8223         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8224         uint64_t ret_ref = tag_ptr(ret_copy, true);
8225         return ret_ref;
8226 }
8227
8228 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8229         LDKStfu ret = *owner->contents.result;
8230         ret.is_owned = false;
8231         return ret;
8232 }
8233 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_ok"))) TS_CResult_StfuDecodeErrorZ_get_ok(uint64_t owner) {
8234         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8235         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8236         uint64_t ret_ref = 0;
8237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8239         return ret_ref;
8240 }
8241
8242 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8243 CHECK(!owner->result_ok);
8244         return DecodeError_clone(&*owner->contents.err);
8245 }
8246 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_err"))) TS_CResult_StfuDecodeErrorZ_get_err(uint64_t owner) {
8247         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8248         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8249         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8250         uint64_t ret_ref = tag_ptr(ret_copy, true);
8251         return ret_ref;
8252 }
8253
8254 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8255         LDKSplice ret = *owner->contents.result;
8256         ret.is_owned = false;
8257         return ret;
8258 }
8259 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_ok"))) TS_CResult_SpliceDecodeErrorZ_get_ok(uint64_t owner) {
8260         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8261         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8262         uint64_t ret_ref = 0;
8263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8265         return ret_ref;
8266 }
8267
8268 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8269 CHECK(!owner->result_ok);
8270         return DecodeError_clone(&*owner->contents.err);
8271 }
8272 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_err"))) TS_CResult_SpliceDecodeErrorZ_get_err(uint64_t owner) {
8273         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8274         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8275         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8276         uint64_t ret_ref = tag_ptr(ret_copy, true);
8277         return ret_ref;
8278 }
8279
8280 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8281         LDKSpliceAck ret = *owner->contents.result;
8282         ret.is_owned = false;
8283         return ret;
8284 }
8285 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_ok"))) TS_CResult_SpliceAckDecodeErrorZ_get_ok(uint64_t owner) {
8286         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8287         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8288         uint64_t ret_ref = 0;
8289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8291         return ret_ref;
8292 }
8293
8294 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8295 CHECK(!owner->result_ok);
8296         return DecodeError_clone(&*owner->contents.err);
8297 }
8298 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_err"))) TS_CResult_SpliceAckDecodeErrorZ_get_err(uint64_t owner) {
8299         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8301         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8302         uint64_t ret_ref = tag_ptr(ret_copy, true);
8303         return ret_ref;
8304 }
8305
8306 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8307         LDKSpliceLocked ret = *owner->contents.result;
8308         ret.is_owned = false;
8309         return ret;
8310 }
8311 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_get_ok(uint64_t owner) {
8312         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8313         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8314         uint64_t ret_ref = 0;
8315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8317         return ret_ref;
8318 }
8319
8320 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8321 CHECK(!owner->result_ok);
8322         return DecodeError_clone(&*owner->contents.err);
8323 }
8324 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_err"))) TS_CResult_SpliceLockedDecodeErrorZ_get_err(uint64_t owner) {
8325         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8326         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8327         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8328         uint64_t ret_ref = tag_ptr(ret_copy, true);
8329         return ret_ref;
8330 }
8331
8332 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8333         LDKTxAddInput ret = *owner->contents.result;
8334         ret.is_owned = false;
8335         return ret;
8336 }
8337 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
8338         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8339         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8340         uint64_t ret_ref = 0;
8341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8343         return ret_ref;
8344 }
8345
8346 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8347 CHECK(!owner->result_ok);
8348         return DecodeError_clone(&*owner->contents.err);
8349 }
8350 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
8351         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8353         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8354         uint64_t ret_ref = tag_ptr(ret_copy, true);
8355         return ret_ref;
8356 }
8357
8358 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8359         LDKTxAddOutput ret = *owner->contents.result;
8360         ret.is_owned = false;
8361         return ret;
8362 }
8363 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
8364         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8365         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8366         uint64_t ret_ref = 0;
8367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8369         return ret_ref;
8370 }
8371
8372 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8373 CHECK(!owner->result_ok);
8374         return DecodeError_clone(&*owner->contents.err);
8375 }
8376 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
8377         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8379         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
8380         uint64_t ret_ref = tag_ptr(ret_copy, true);
8381         return ret_ref;
8382 }
8383
8384 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8385         LDKTxRemoveInput ret = *owner->contents.result;
8386         ret.is_owned = false;
8387         return ret;
8388 }
8389 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
8390         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8391         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
8392         uint64_t ret_ref = 0;
8393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8395         return ret_ref;
8396 }
8397
8398 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8399 CHECK(!owner->result_ok);
8400         return DecodeError_clone(&*owner->contents.err);
8401 }
8402 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
8403         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8405         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
8406         uint64_t ret_ref = tag_ptr(ret_copy, true);
8407         return ret_ref;
8408 }
8409
8410 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8411         LDKTxRemoveOutput ret = *owner->contents.result;
8412         ret.is_owned = false;
8413         return ret;
8414 }
8415 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
8416         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8417         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
8418         uint64_t ret_ref = 0;
8419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8421         return ret_ref;
8422 }
8423
8424 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8425 CHECK(!owner->result_ok);
8426         return DecodeError_clone(&*owner->contents.err);
8427 }
8428 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
8429         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8431         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
8432         uint64_t ret_ref = tag_ptr(ret_copy, true);
8433         return ret_ref;
8434 }
8435
8436 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8437         LDKTxComplete ret = *owner->contents.result;
8438         ret.is_owned = false;
8439         return ret;
8440 }
8441 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
8442         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8443         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
8444         uint64_t ret_ref = 0;
8445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8447         return ret_ref;
8448 }
8449
8450 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8451 CHECK(!owner->result_ok);
8452         return DecodeError_clone(&*owner->contents.err);
8453 }
8454 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
8455         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8457         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
8458         uint64_t ret_ref = tag_ptr(ret_copy, true);
8459         return ret_ref;
8460 }
8461
8462 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8463         LDKTxSignatures ret = *owner->contents.result;
8464         ret.is_owned = false;
8465         return ret;
8466 }
8467 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
8468         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8469         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
8470         uint64_t ret_ref = 0;
8471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8473         return ret_ref;
8474 }
8475
8476 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8477 CHECK(!owner->result_ok);
8478         return DecodeError_clone(&*owner->contents.err);
8479 }
8480 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
8481         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8483         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
8484         uint64_t ret_ref = tag_ptr(ret_copy, true);
8485         return ret_ref;
8486 }
8487
8488 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
8489         LDKTxInitRbf ret = *owner->contents.result;
8490         ret.is_owned = false;
8491         return ret;
8492 }
8493 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
8494         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
8495         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
8496         uint64_t ret_ref = 0;
8497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8499         return ret_ref;
8500 }
8501
8502 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
8503 CHECK(!owner->result_ok);
8504         return DecodeError_clone(&*owner->contents.err);
8505 }
8506 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
8507         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
8508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8509         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
8510         uint64_t ret_ref = tag_ptr(ret_copy, true);
8511         return ret_ref;
8512 }
8513
8514 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
8515         LDKTxAckRbf ret = *owner->contents.result;
8516         ret.is_owned = false;
8517         return ret;
8518 }
8519 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
8520         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
8521         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
8522         uint64_t ret_ref = 0;
8523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8525         return ret_ref;
8526 }
8527
8528 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
8529 CHECK(!owner->result_ok);
8530         return DecodeError_clone(&*owner->contents.err);
8531 }
8532 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
8533         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
8534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8535         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
8536         uint64_t ret_ref = tag_ptr(ret_copy, true);
8537         return ret_ref;
8538 }
8539
8540 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
8541         LDKTxAbort ret = *owner->contents.result;
8542         ret.is_owned = false;
8543         return ret;
8544 }
8545 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
8546         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
8547         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
8548         uint64_t ret_ref = 0;
8549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8551         return ret_ref;
8552 }
8553
8554 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
8555 CHECK(!owner->result_ok);
8556         return DecodeError_clone(&*owner->contents.err);
8557 }
8558 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
8559         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
8560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8561         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
8562         uint64_t ret_ref = tag_ptr(ret_copy, true);
8563         return ret_ref;
8564 }
8565
8566 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8567         LDKAnnouncementSignatures ret = *owner->contents.result;
8568         ret.is_owned = false;
8569         return ret;
8570 }
8571 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
8572         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8573         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8574         uint64_t ret_ref = 0;
8575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8577         return ret_ref;
8578 }
8579
8580 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8581 CHECK(!owner->result_ok);
8582         return DecodeError_clone(&*owner->contents.err);
8583 }
8584 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
8585         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8587         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8588         uint64_t ret_ref = tag_ptr(ret_copy, true);
8589         return ret_ref;
8590 }
8591
8592 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8593         LDKChannelReestablish ret = *owner->contents.result;
8594         ret.is_owned = false;
8595         return ret;
8596 }
8597 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
8598         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8599         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8600         uint64_t ret_ref = 0;
8601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8603         return ret_ref;
8604 }
8605
8606 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8607 CHECK(!owner->result_ok);
8608         return DecodeError_clone(&*owner->contents.err);
8609 }
8610 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
8611         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8613         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8614         uint64_t ret_ref = tag_ptr(ret_copy, true);
8615         return ret_ref;
8616 }
8617
8618 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8619         LDKClosingSigned ret = *owner->contents.result;
8620         ret.is_owned = false;
8621         return ret;
8622 }
8623 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
8624         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8625         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8626         uint64_t ret_ref = 0;
8627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8629         return ret_ref;
8630 }
8631
8632 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8633 CHECK(!owner->result_ok);
8634         return DecodeError_clone(&*owner->contents.err);
8635 }
8636 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
8637         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8638         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8639         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8640         uint64_t ret_ref = tag_ptr(ret_copy, true);
8641         return ret_ref;
8642 }
8643
8644 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8645         LDKClosingSignedFeeRange ret = *owner->contents.result;
8646         ret.is_owned = false;
8647         return ret;
8648 }
8649 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
8650         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8651         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8652         uint64_t ret_ref = 0;
8653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8655         return ret_ref;
8656 }
8657
8658 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8659 CHECK(!owner->result_ok);
8660         return DecodeError_clone(&*owner->contents.err);
8661 }
8662 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
8663         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8665         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8666         uint64_t ret_ref = tag_ptr(ret_copy, true);
8667         return ret_ref;
8668 }
8669
8670 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8671         LDKCommitmentSigned ret = *owner->contents.result;
8672         ret.is_owned = false;
8673         return ret;
8674 }
8675 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
8676         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8677         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8678         uint64_t ret_ref = 0;
8679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8681         return ret_ref;
8682 }
8683
8684 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8685 CHECK(!owner->result_ok);
8686         return DecodeError_clone(&*owner->contents.err);
8687 }
8688 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
8689         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8691         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8692         uint64_t ret_ref = tag_ptr(ret_copy, true);
8693         return ret_ref;
8694 }
8695
8696 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8697         LDKFundingCreated ret = *owner->contents.result;
8698         ret.is_owned = false;
8699         return ret;
8700 }
8701 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
8702         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8703         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8704         uint64_t ret_ref = 0;
8705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8707         return ret_ref;
8708 }
8709
8710 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8711 CHECK(!owner->result_ok);
8712         return DecodeError_clone(&*owner->contents.err);
8713 }
8714 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
8715         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8717         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8718         uint64_t ret_ref = tag_ptr(ret_copy, true);
8719         return ret_ref;
8720 }
8721
8722 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8723         LDKFundingSigned ret = *owner->contents.result;
8724         ret.is_owned = false;
8725         return ret;
8726 }
8727 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
8728         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8729         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8730         uint64_t ret_ref = 0;
8731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8733         return ret_ref;
8734 }
8735
8736 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8737 CHECK(!owner->result_ok);
8738         return DecodeError_clone(&*owner->contents.err);
8739 }
8740 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
8741         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8743         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8744         uint64_t ret_ref = tag_ptr(ret_copy, true);
8745         return ret_ref;
8746 }
8747
8748 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8749         LDKChannelReady ret = *owner->contents.result;
8750         ret.is_owned = false;
8751         return ret;
8752 }
8753 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
8754         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8755         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8756         uint64_t ret_ref = 0;
8757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8759         return ret_ref;
8760 }
8761
8762 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8763 CHECK(!owner->result_ok);
8764         return DecodeError_clone(&*owner->contents.err);
8765 }
8766 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
8767         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8769         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8770         uint64_t ret_ref = tag_ptr(ret_copy, true);
8771         return ret_ref;
8772 }
8773
8774 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8775         LDKInit ret = *owner->contents.result;
8776         ret.is_owned = false;
8777         return ret;
8778 }
8779 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
8780         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8781         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8782         uint64_t ret_ref = 0;
8783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8785         return ret_ref;
8786 }
8787
8788 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8789 CHECK(!owner->result_ok);
8790         return DecodeError_clone(&*owner->contents.err);
8791 }
8792 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
8793         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8794         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8795         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
8796         uint64_t ret_ref = tag_ptr(ret_copy, true);
8797         return ret_ref;
8798 }
8799
8800 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8801         LDKOpenChannel ret = *owner->contents.result;
8802         ret.is_owned = false;
8803         return ret;
8804 }
8805 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
8806         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8807         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8808         uint64_t ret_ref = 0;
8809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8811         return ret_ref;
8812 }
8813
8814 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8815 CHECK(!owner->result_ok);
8816         return DecodeError_clone(&*owner->contents.err);
8817 }
8818 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
8819         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8820         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8821         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8822         uint64_t ret_ref = tag_ptr(ret_copy, true);
8823         return ret_ref;
8824 }
8825
8826 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8827         LDKOpenChannelV2 ret = *owner->contents.result;
8828         ret.is_owned = false;
8829         return ret;
8830 }
8831 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8832         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8833         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
8834         uint64_t ret_ref = 0;
8835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8837         return ret_ref;
8838 }
8839
8840 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8841 CHECK(!owner->result_ok);
8842         return DecodeError_clone(&*owner->contents.err);
8843 }
8844 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8845         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8846         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8847         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
8848         uint64_t ret_ref = tag_ptr(ret_copy, true);
8849         return ret_ref;
8850 }
8851
8852 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8853         LDKRevokeAndACK ret = *owner->contents.result;
8854         ret.is_owned = false;
8855         return ret;
8856 }
8857 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
8858         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8859         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8860         uint64_t ret_ref = 0;
8861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8863         return ret_ref;
8864 }
8865
8866 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8867 CHECK(!owner->result_ok);
8868         return DecodeError_clone(&*owner->contents.err);
8869 }
8870 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
8871         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8873         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8874         uint64_t ret_ref = tag_ptr(ret_copy, true);
8875         return ret_ref;
8876 }
8877
8878 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8879         LDKShutdown ret = *owner->contents.result;
8880         ret.is_owned = false;
8881         return ret;
8882 }
8883 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
8884         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8885         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8886         uint64_t ret_ref = 0;
8887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8889         return ret_ref;
8890 }
8891
8892 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8893 CHECK(!owner->result_ok);
8894         return DecodeError_clone(&*owner->contents.err);
8895 }
8896 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
8897         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8898         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8899         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8900         uint64_t ret_ref = tag_ptr(ret_copy, true);
8901         return ret_ref;
8902 }
8903
8904 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8905         LDKUpdateFailHTLC ret = *owner->contents.result;
8906         ret.is_owned = false;
8907         return ret;
8908 }
8909 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8910         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8911         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8912         uint64_t ret_ref = 0;
8913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8915         return ret_ref;
8916 }
8917
8918 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8919 CHECK(!owner->result_ok);
8920         return DecodeError_clone(&*owner->contents.err);
8921 }
8922 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8923         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8924         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8925         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8926         uint64_t ret_ref = tag_ptr(ret_copy, true);
8927         return ret_ref;
8928 }
8929
8930 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8931         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8932         ret.is_owned = false;
8933         return ret;
8934 }
8935 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8936         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8937         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8938         uint64_t ret_ref = 0;
8939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8941         return ret_ref;
8942 }
8943
8944 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8945 CHECK(!owner->result_ok);
8946         return DecodeError_clone(&*owner->contents.err);
8947 }
8948 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8949         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8951         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8952         uint64_t ret_ref = tag_ptr(ret_copy, true);
8953         return ret_ref;
8954 }
8955
8956 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8957         LDKUpdateFee ret = *owner->contents.result;
8958         ret.is_owned = false;
8959         return ret;
8960 }
8961 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8962         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8963         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8964         uint64_t ret_ref = 0;
8965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8967         return ret_ref;
8968 }
8969
8970 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8971 CHECK(!owner->result_ok);
8972         return DecodeError_clone(&*owner->contents.err);
8973 }
8974 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8975         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8977         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8978         uint64_t ret_ref = tag_ptr(ret_copy, true);
8979         return ret_ref;
8980 }
8981
8982 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8983         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8984         ret.is_owned = false;
8985         return ret;
8986 }
8987 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8988         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8989         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8990         uint64_t ret_ref = 0;
8991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8993         return ret_ref;
8994 }
8995
8996 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8997 CHECK(!owner->result_ok);
8998         return DecodeError_clone(&*owner->contents.err);
8999 }
9000 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9001         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9003         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9004         uint64_t ret_ref = tag_ptr(ret_copy, true);
9005         return ret_ref;
9006 }
9007
9008 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9009         LDKOnionPacket ret = *owner->contents.result;
9010         ret.is_owned = false;
9011         return ret;
9012 }
9013 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_ok"))) TS_CResult_OnionPacketDecodeErrorZ_get_ok(uint64_t owner) {
9014         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9015         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9016         uint64_t ret_ref = 0;
9017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9019         return ret_ref;
9020 }
9021
9022 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9023 CHECK(!owner->result_ok);
9024         return DecodeError_clone(&*owner->contents.err);
9025 }
9026 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_err"))) TS_CResult_OnionPacketDecodeErrorZ_get_err(uint64_t owner) {
9027         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9028         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9029         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9030         uint64_t ret_ref = tag_ptr(ret_copy, true);
9031         return ret_ref;
9032 }
9033
9034 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9035         LDKUpdateAddHTLC ret = *owner->contents.result;
9036         ret.is_owned = false;
9037         return ret;
9038 }
9039 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9040         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9041         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9042         uint64_t ret_ref = 0;
9043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9045         return ret_ref;
9046 }
9047
9048 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9049 CHECK(!owner->result_ok);
9050         return DecodeError_clone(&*owner->contents.err);
9051 }
9052 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9053         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9054         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9055         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9056         uint64_t ret_ref = tag_ptr(ret_copy, true);
9057         return ret_ref;
9058 }
9059
9060 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9061         LDKOnionMessage ret = *owner->contents.result;
9062         ret.is_owned = false;
9063         return ret;
9064 }
9065 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9066         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9067         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9068         uint64_t ret_ref = 0;
9069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9071         return ret_ref;
9072 }
9073
9074 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9075 CHECK(!owner->result_ok);
9076         return DecodeError_clone(&*owner->contents.err);
9077 }
9078 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9079         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9081         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9082         uint64_t ret_ref = tag_ptr(ret_copy, true);
9083         return ret_ref;
9084 }
9085
9086 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9087         LDKFinalOnionHopData ret = *owner->contents.result;
9088         ret.is_owned = false;
9089         return ret;
9090 }
9091 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(uint64_t owner) {
9092         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9093         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9094         uint64_t ret_ref = 0;
9095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9097         return ret_ref;
9098 }
9099
9100 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9101 CHECK(!owner->result_ok);
9102         return DecodeError_clone(&*owner->contents.err);
9103 }
9104 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err(uint64_t owner) {
9105         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9106         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9107         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9108         uint64_t ret_ref = tag_ptr(ret_copy, true);
9109         return ret_ref;
9110 }
9111
9112 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9113         LDKPing ret = *owner->contents.result;
9114         ret.is_owned = false;
9115         return ret;
9116 }
9117 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9118         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9119         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9120         uint64_t ret_ref = 0;
9121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9123         return ret_ref;
9124 }
9125
9126 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9127 CHECK(!owner->result_ok);
9128         return DecodeError_clone(&*owner->contents.err);
9129 }
9130 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9131         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9132         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9133         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9134         uint64_t ret_ref = tag_ptr(ret_copy, true);
9135         return ret_ref;
9136 }
9137
9138 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9139         LDKPong ret = *owner->contents.result;
9140         ret.is_owned = false;
9141         return ret;
9142 }
9143 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9144         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9145         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9146         uint64_t ret_ref = 0;
9147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9149         return ret_ref;
9150 }
9151
9152 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9153 CHECK(!owner->result_ok);
9154         return DecodeError_clone(&*owner->contents.err);
9155 }
9156 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9157         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9159         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9160         uint64_t ret_ref = tag_ptr(ret_copy, true);
9161         return ret_ref;
9162 }
9163
9164 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9165         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9166         ret.is_owned = false;
9167         return ret;
9168 }
9169 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9170         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9171         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9172         uint64_t ret_ref = 0;
9173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9175         return ret_ref;
9176 }
9177
9178 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9179 CHECK(!owner->result_ok);
9180         return DecodeError_clone(&*owner->contents.err);
9181 }
9182 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9183         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9184         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9185         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9186         uint64_t ret_ref = tag_ptr(ret_copy, true);
9187         return ret_ref;
9188 }
9189
9190 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9191         LDKChannelAnnouncement ret = *owner->contents.result;
9192         ret.is_owned = false;
9193         return ret;
9194 }
9195 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9196         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9197         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9198         uint64_t ret_ref = 0;
9199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9201         return ret_ref;
9202 }
9203
9204 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9205 CHECK(!owner->result_ok);
9206         return DecodeError_clone(&*owner->contents.err);
9207 }
9208 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9209         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9211         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9212         uint64_t ret_ref = tag_ptr(ret_copy, true);
9213         return ret_ref;
9214 }
9215
9216 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9217         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9218         ret.is_owned = false;
9219         return ret;
9220 }
9221 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9222         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9223         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9224         uint64_t ret_ref = 0;
9225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9227         return ret_ref;
9228 }
9229
9230 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9231 CHECK(!owner->result_ok);
9232         return DecodeError_clone(&*owner->contents.err);
9233 }
9234 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9235         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9237         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9238         uint64_t ret_ref = tag_ptr(ret_copy, true);
9239         return ret_ref;
9240 }
9241
9242 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9243         LDKChannelUpdate ret = *owner->contents.result;
9244         ret.is_owned = false;
9245         return ret;
9246 }
9247 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9248         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9249         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9250         uint64_t ret_ref = 0;
9251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9253         return ret_ref;
9254 }
9255
9256 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9257 CHECK(!owner->result_ok);
9258         return DecodeError_clone(&*owner->contents.err);
9259 }
9260 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9261         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9263         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9264         uint64_t ret_ref = tag_ptr(ret_copy, true);
9265         return ret_ref;
9266 }
9267
9268 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9269         LDKErrorMessage ret = *owner->contents.result;
9270         ret.is_owned = false;
9271         return ret;
9272 }
9273 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9274         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9275         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9276         uint64_t ret_ref = 0;
9277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9279         return ret_ref;
9280 }
9281
9282 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9283 CHECK(!owner->result_ok);
9284         return DecodeError_clone(&*owner->contents.err);
9285 }
9286 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9287         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9289         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9290         uint64_t ret_ref = tag_ptr(ret_copy, true);
9291         return ret_ref;
9292 }
9293
9294 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9295         LDKWarningMessage ret = *owner->contents.result;
9296         ret.is_owned = false;
9297         return ret;
9298 }
9299 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9300         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9301         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9302         uint64_t ret_ref = 0;
9303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9305         return ret_ref;
9306 }
9307
9308 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9309 CHECK(!owner->result_ok);
9310         return DecodeError_clone(&*owner->contents.err);
9311 }
9312 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9313         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9314         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9315         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9316         uint64_t ret_ref = tag_ptr(ret_copy, true);
9317         return ret_ref;
9318 }
9319
9320 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9321         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9322         ret.is_owned = false;
9323         return ret;
9324 }
9325 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9326         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9327         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9328         uint64_t ret_ref = 0;
9329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9331         return ret_ref;
9332 }
9333
9334 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9335 CHECK(!owner->result_ok);
9336         return DecodeError_clone(&*owner->contents.err);
9337 }
9338 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9339         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9340         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9341         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9342         uint64_t ret_ref = tag_ptr(ret_copy, true);
9343         return ret_ref;
9344 }
9345
9346 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9347         LDKNodeAnnouncement ret = *owner->contents.result;
9348         ret.is_owned = false;
9349         return ret;
9350 }
9351 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9352         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9353         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9354         uint64_t ret_ref = 0;
9355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9357         return ret_ref;
9358 }
9359
9360 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9361 CHECK(!owner->result_ok);
9362         return DecodeError_clone(&*owner->contents.err);
9363 }
9364 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9365         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9366         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9367         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9368         uint64_t ret_ref = tag_ptr(ret_copy, true);
9369         return ret_ref;
9370 }
9371
9372 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9373         LDKQueryShortChannelIds ret = *owner->contents.result;
9374         ret.is_owned = false;
9375         return ret;
9376 }
9377 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
9378         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9379         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9380         uint64_t ret_ref = 0;
9381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9383         return ret_ref;
9384 }
9385
9386 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9387 CHECK(!owner->result_ok);
9388         return DecodeError_clone(&*owner->contents.err);
9389 }
9390 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
9391         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9392         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9393         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9394         uint64_t ret_ref = tag_ptr(ret_copy, true);
9395         return ret_ref;
9396 }
9397
9398 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9399         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9400         ret.is_owned = false;
9401         return ret;
9402 }
9403 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
9404         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9405         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9406         uint64_t ret_ref = 0;
9407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9409         return ret_ref;
9410 }
9411
9412 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9413 CHECK(!owner->result_ok);
9414         return DecodeError_clone(&*owner->contents.err);
9415 }
9416 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
9417         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9418         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9419         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9420         uint64_t ret_ref = tag_ptr(ret_copy, true);
9421         return ret_ref;
9422 }
9423
9424 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9425         LDKQueryChannelRange ret = *owner->contents.result;
9426         ret.is_owned = false;
9427         return ret;
9428 }
9429 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9430         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9431         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9432         uint64_t ret_ref = 0;
9433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9435         return ret_ref;
9436 }
9437
9438 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9439 CHECK(!owner->result_ok);
9440         return DecodeError_clone(&*owner->contents.err);
9441 }
9442 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9443         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9445         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9446         uint64_t ret_ref = tag_ptr(ret_copy, true);
9447         return ret_ref;
9448 }
9449
9450 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9451         LDKReplyChannelRange ret = *owner->contents.result;
9452         ret.is_owned = false;
9453         return ret;
9454 }
9455 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9456         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9457         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9458         uint64_t ret_ref = 0;
9459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9461         return ret_ref;
9462 }
9463
9464 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9465 CHECK(!owner->result_ok);
9466         return DecodeError_clone(&*owner->contents.err);
9467 }
9468 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9469         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9471         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9472         uint64_t ret_ref = tag_ptr(ret_copy, true);
9473         return ret_ref;
9474 }
9475
9476 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9477         LDKGossipTimestampFilter ret = *owner->contents.result;
9478         ret.is_owned = false;
9479         return ret;
9480 }
9481 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
9482         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9483         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9484         uint64_t ret_ref = 0;
9485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9487         return ret_ref;
9488 }
9489
9490 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9491 CHECK(!owner->result_ok);
9492         return DecodeError_clone(&*owner->contents.err);
9493 }
9494 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
9495         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9496         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9497         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9498         uint64_t ret_ref = tag_ptr(ret_copy, true);
9499         return ret_ref;
9500 }
9501
9502 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9503         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9504         for (size_t i = 0; i < ret.datalen; i++) {
9505                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9506         }
9507         return ret;
9508 }
9509 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
9510         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9511         switch(obj->tag) {
9512                 case LDKSignOrCreationError_SignError: return 0;
9513                 case LDKSignOrCreationError_CreationError: return 1;
9514                 default: abort();
9515         }
9516 }
9517 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
9518         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9519         assert(obj->tag == LDKSignOrCreationError_CreationError);
9520         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
9521         return creation_error_conv;
9522 }
9523 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9524         LDKBolt11Invoice ret = *owner->contents.result;
9525         ret.is_owned = false;
9526         return ret;
9527 }
9528 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
9529         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9530         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9531         uint64_t ret_ref = 0;
9532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9534         return ret_ref;
9535 }
9536
9537 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9538 CHECK(!owner->result_ok);
9539         return SignOrCreationError_clone(&*owner->contents.err);
9540 }
9541 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
9542         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9543         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9544         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9545         uint64_t ret_ref = tag_ptr(ret_copy, true);
9546         return ret_ref;
9547 }
9548
9549 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
9550 CHECK(owner->result_ok);
9551         return OffersMessage_clone(&*owner->contents.result);
9552 }
9553 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
9554         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
9555         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
9556         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
9557         uint64_t ret_ref = tag_ptr(ret_copy, true);
9558         return ret_ref;
9559 }
9560
9561 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
9562 CHECK(!owner->result_ok);
9563         return DecodeError_clone(&*owner->contents.err);
9564 }
9565 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
9566         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
9567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9568         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
9569         uint64_t ret_ref = tag_ptr(ret_copy, true);
9570         return ret_ref;
9571 }
9572
9573 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
9574         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
9575         switch(obj->tag) {
9576                 case LDKCOption_HTLCClaimZ_Some: return 0;
9577                 case LDKCOption_HTLCClaimZ_None: return 1;
9578                 default: abort();
9579         }
9580 }
9581 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
9582         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
9583         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
9584         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
9585         return some_conv;
9586 }
9587 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
9588         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
9589         ret.is_owned = false;
9590         return ret;
9591 }
9592 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
9593         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
9594         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
9595         uint64_t ret_ref = 0;
9596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9598         return ret_ref;
9599 }
9600
9601 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
9602 CHECK(!owner->result_ok);
9603         return DecodeError_clone(&*owner->contents.err);
9604 }
9605 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
9606         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
9607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9608         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
9609         uint64_t ret_ref = tag_ptr(ret_copy, true);
9610         return ret_ref;
9611 }
9612
9613 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
9614         LDKTxCreationKeys ret = *owner->contents.result;
9615         ret.is_owned = false;
9616         return ret;
9617 }
9618 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
9619         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
9620         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
9621         uint64_t ret_ref = 0;
9622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9624         return ret_ref;
9625 }
9626
9627 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
9628 CHECK(!owner->result_ok);
9629         return DecodeError_clone(&*owner->contents.err);
9630 }
9631 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
9632         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
9633         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9634         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
9635         uint64_t ret_ref = tag_ptr(ret_copy, true);
9636         return ret_ref;
9637 }
9638
9639 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
9640         LDKChannelPublicKeys ret = *owner->contents.result;
9641         ret.is_owned = false;
9642         return ret;
9643 }
9644 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
9645         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
9646         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
9647         uint64_t ret_ref = 0;
9648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9650         return ret_ref;
9651 }
9652
9653 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
9654 CHECK(!owner->result_ok);
9655         return DecodeError_clone(&*owner->contents.err);
9656 }
9657 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
9658         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
9659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9660         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
9661         uint64_t ret_ref = tag_ptr(ret_copy, true);
9662         return ret_ref;
9663 }
9664
9665 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
9666         LDKHTLCOutputInCommitment ret = *owner->contents.result;
9667         ret.is_owned = false;
9668         return ret;
9669 }
9670 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
9671         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
9672         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
9673         uint64_t ret_ref = 0;
9674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9676         return ret_ref;
9677 }
9678
9679 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
9680 CHECK(!owner->result_ok);
9681         return DecodeError_clone(&*owner->contents.err);
9682 }
9683 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
9684         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
9685         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9686         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
9687         uint64_t ret_ref = tag_ptr(ret_copy, true);
9688         return ret_ref;
9689 }
9690
9691 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9692         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
9693         ret.is_owned = false;
9694         return ret;
9695 }
9696 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
9697         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9698         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
9699         uint64_t ret_ref = 0;
9700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9702         return ret_ref;
9703 }
9704
9705 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9706 CHECK(!owner->result_ok);
9707         return DecodeError_clone(&*owner->contents.err);
9708 }
9709 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
9710         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9712         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
9713         uint64_t ret_ref = tag_ptr(ret_copy, true);
9714         return ret_ref;
9715 }
9716
9717 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9718         LDKChannelTransactionParameters ret = *owner->contents.result;
9719         ret.is_owned = false;
9720         return ret;
9721 }
9722 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
9723         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9724         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
9725         uint64_t ret_ref = 0;
9726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9728         return ret_ref;
9729 }
9730
9731 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9732 CHECK(!owner->result_ok);
9733         return DecodeError_clone(&*owner->contents.err);
9734 }
9735 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
9736         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9738         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
9739         uint64_t ret_ref = tag_ptr(ret_copy, true);
9740         return ret_ref;
9741 }
9742
9743 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9744         LDKHolderCommitmentTransaction ret = *owner->contents.result;
9745         ret.is_owned = false;
9746         return ret;
9747 }
9748 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9749         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9750         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
9751         uint64_t ret_ref = 0;
9752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9754         return ret_ref;
9755 }
9756
9757 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9758 CHECK(!owner->result_ok);
9759         return DecodeError_clone(&*owner->contents.err);
9760 }
9761 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9762         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9764         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9765         uint64_t ret_ref = tag_ptr(ret_copy, true);
9766         return ret_ref;
9767 }
9768
9769 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9770         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
9771         ret.is_owned = false;
9772         return ret;
9773 }
9774 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9775         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9776         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
9777         uint64_t ret_ref = 0;
9778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9780         return ret_ref;
9781 }
9782
9783 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9784 CHECK(!owner->result_ok);
9785         return DecodeError_clone(&*owner->contents.err);
9786 }
9787 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9788         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9790         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9791         uint64_t ret_ref = tag_ptr(ret_copy, true);
9792         return ret_ref;
9793 }
9794
9795 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
9796         LDKTrustedClosingTransaction ret = *owner->contents.result;
9797         ret.is_owned = false;
9798         return ret;
9799 }
9800 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
9801         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
9802         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
9803         uint64_t ret_ref = 0;
9804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9806         return ret_ref;
9807 }
9808
9809 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
9810 CHECK(!owner->result_ok);
9811         return *owner->contents.err;
9812 }
9813 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
9814         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
9815         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
9816 }
9817
9818 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9819         LDKCommitmentTransaction ret = *owner->contents.result;
9820         ret.is_owned = false;
9821         return ret;
9822 }
9823 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9824         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9825         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
9826         uint64_t ret_ref = 0;
9827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9829         return ret_ref;
9830 }
9831
9832 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9833 CHECK(!owner->result_ok);
9834         return DecodeError_clone(&*owner->contents.err);
9835 }
9836 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9837         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9838         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9839         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9840         uint64_t ret_ref = tag_ptr(ret_copy, true);
9841         return ret_ref;
9842 }
9843
9844 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9845         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
9846         ret.is_owned = false;
9847         return ret;
9848 }
9849 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
9850         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9851         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
9852         uint64_t ret_ref = 0;
9853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9855         return ret_ref;
9856 }
9857
9858 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9859 CHECK(!owner->result_ok);
9860         return *owner->contents.err;
9861 }
9862 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
9863         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9864         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
9865 }
9866
9867 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9868 CHECK(owner->result_ok);
9869         return *owner->contents.result;
9870 }
9871 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
9872         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9873         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
9874         ptrArray ret_arr = NULL;
9875         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9876         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
9877         for (size_t m = 0; m < ret_var.datalen; m++) {
9878                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
9879                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
9880                 ret_arr_ptr[m] = ret_conv_12_arr;
9881         }
9882         
9883         return ret_arr;
9884 }
9885
9886 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9887 CHECK(!owner->result_ok);
9888         return *owner->contents.err;
9889 }
9890 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
9891         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9892         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
9893 }
9894
9895 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
9896         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9897         switch(obj->tag) {
9898                 case LDKCOption_usizeZ_Some: return 0;
9899                 case LDKCOption_usizeZ_None: return 1;
9900                 default: abort();
9901         }
9902 }
9903 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
9904         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9905         assert(obj->tag == LDKCOption_usizeZ_Some);
9906         uint32_t some_conv = obj->some;
9907         return some_conv;
9908 }
9909 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9910         LDKShutdownScript ret = *owner->contents.result;
9911         ret.is_owned = false;
9912         return ret;
9913 }
9914 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
9915         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9916         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
9917         uint64_t ret_ref = 0;
9918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9920         return ret_ref;
9921 }
9922
9923 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9924 CHECK(!owner->result_ok);
9925         return DecodeError_clone(&*owner->contents.err);
9926 }
9927 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
9928         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9929         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9930         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
9931         uint64_t ret_ref = tag_ptr(ret_copy, true);
9932         return ret_ref;
9933 }
9934
9935 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9936         LDKShutdownScript ret = *owner->contents.result;
9937         ret.is_owned = false;
9938         return ret;
9939 }
9940 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
9941         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9942         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
9943         uint64_t ret_ref = 0;
9944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9946         return ret_ref;
9947 }
9948
9949 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9950         LDKInvalidShutdownScript ret = *owner->contents.err;
9951         ret.is_owned = false;
9952         return ret;
9953 }
9954 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
9955         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9956         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
9957         uint64_t ret_ref = 0;
9958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9960         return ret_ref;
9961 }
9962
9963 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
9964         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9965         switch(obj->tag) {
9966                 case LDKPaymentPurpose_InvoicePayment: return 0;
9967                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
9968                 default: abort();
9969         }
9970 }
9971 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
9972         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9973         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9974         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
9975         return payment_preimage_ref;
9976 }
9977 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
9978         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9979         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9980         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9981         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
9982         return payment_secret_arr;
9983 }
9984 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
9985         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9986         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
9987         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
9988         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
9989         return spontaneous_payment_arr;
9990 }
9991 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9992 CHECK(owner->result_ok);
9993         return PaymentPurpose_clone(&*owner->contents.result);
9994 }
9995 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
9996         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9997         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
9998         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
9999         uint64_t ret_ref = tag_ptr(ret_copy, true);
10000         return ret_ref;
10001 }
10002
10003 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10004 CHECK(!owner->result_ok);
10005         return DecodeError_clone(&*owner->contents.err);
10006 }
10007 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
10008         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10010         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10011         uint64_t ret_ref = tag_ptr(ret_copy, true);
10012         return ret_ref;
10013 }
10014
10015 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10016         LDKClaimedHTLC ret = *owner->contents.result;
10017         ret.is_owned = false;
10018         return ret;
10019 }
10020 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
10021         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10022         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10023         uint64_t ret_ref = 0;
10024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10026         return ret_ref;
10027 }
10028
10029 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10030 CHECK(!owner->result_ok);
10031         return DecodeError_clone(&*owner->contents.err);
10032 }
10033 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
10034         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10035         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10036         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10037         uint64_t ret_ref = tag_ptr(ret_copy, true);
10038         return ret_ref;
10039 }
10040
10041 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
10042         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10043         switch(obj->tag) {
10044                 case LDKPathFailure_InitialSend: return 0;
10045                 case LDKPathFailure_OnPath: return 1;
10046                 default: abort();
10047         }
10048 }
10049 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
10050         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10051         assert(obj->tag == LDKPathFailure_InitialSend);
10052         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10053         return err_ref;
10054 }
10055 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
10056         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10057         assert(obj->tag == LDKPathFailure_OnPath);
10058         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10059         return network_update_ref;
10060 }
10061 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
10062         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10063         switch(obj->tag) {
10064                 case LDKCOption_PathFailureZ_Some: return 0;
10065                 case LDKCOption_PathFailureZ_None: return 1;
10066                 default: abort();
10067         }
10068 }
10069 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
10070         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10071         assert(obj->tag == LDKCOption_PathFailureZ_Some);
10072         uint64_t some_ref = tag_ptr(&obj->some, false);
10073         return some_ref;
10074 }
10075 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10076 CHECK(owner->result_ok);
10077         return COption_PathFailureZ_clone(&*owner->contents.result);
10078 }
10079 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
10080         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10081         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10082         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10083         uint64_t ret_ref = tag_ptr(ret_copy, true);
10084         return ret_ref;
10085 }
10086
10087 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10088 CHECK(!owner->result_ok);
10089         return DecodeError_clone(&*owner->contents.err);
10090 }
10091 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
10092         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10094         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10095         uint64_t ret_ref = tag_ptr(ret_copy, true);
10096         return ret_ref;
10097 }
10098
10099 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
10100         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10101         switch(obj->tag) {
10102                 case LDKClosureReason_CounterpartyForceClosed: return 0;
10103                 case LDKClosureReason_HolderForceClosed: return 1;
10104                 case LDKClosureReason_CooperativeClosure: return 2;
10105                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
10106                 case LDKClosureReason_FundingTimedOut: return 4;
10107                 case LDKClosureReason_ProcessingError: return 5;
10108                 case LDKClosureReason_DisconnectedPeer: return 6;
10109                 case LDKClosureReason_OutdatedChannelManager: return 7;
10110                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
10111                 case LDKClosureReason_FundingBatchClosure: return 9;
10112                 default: abort();
10113         }
10114 }
10115 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
10116         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10117         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
10118         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
10119                         uint64_t peer_msg_ref = 0;
10120                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
10121                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
10122         return peer_msg_ref;
10123 }
10124 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
10125         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10126         assert(obj->tag == LDKClosureReason_ProcessingError);
10127         LDKStr err_str = obj->processing_error.err;
10128                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
10129         return err_conv;
10130 }
10131 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
10132         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10133         switch(obj->tag) {
10134                 case LDKCOption_ClosureReasonZ_Some: return 0;
10135                 case LDKCOption_ClosureReasonZ_None: return 1;
10136                 default: abort();
10137         }
10138 }
10139 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
10140         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10141         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
10142         uint64_t some_ref = tag_ptr(&obj->some, false);
10143         return some_ref;
10144 }
10145 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10146 CHECK(owner->result_ok);
10147         return COption_ClosureReasonZ_clone(&*owner->contents.result);
10148 }
10149 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
10150         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10151         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
10152         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
10153         uint64_t ret_ref = tag_ptr(ret_copy, true);
10154         return ret_ref;
10155 }
10156
10157 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10158 CHECK(!owner->result_ok);
10159         return DecodeError_clone(&*owner->contents.err);
10160 }
10161 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
10162         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10163         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10164         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
10165         uint64_t ret_ref = tag_ptr(ret_copy, true);
10166         return ret_ref;
10167 }
10168
10169 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
10170         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10171         switch(obj->tag) {
10172                 case LDKHTLCDestination_NextHopChannel: return 0;
10173                 case LDKHTLCDestination_UnknownNextHop: return 1;
10174                 case LDKHTLCDestination_InvalidForward: return 2;
10175                 case LDKHTLCDestination_FailedPayment: return 3;
10176                 default: abort();
10177         }
10178 }
10179 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
10180         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10181         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10182         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10183         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
10184         return node_id_arr;
10185 }
10186 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
10187         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10188         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10189         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10190         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
10191         return channel_id_arr;
10192 }
10193 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
10194         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10195         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
10196         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
10197         return requested_forward_scid_conv;
10198 }
10199 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
10200         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10201         assert(obj->tag == LDKHTLCDestination_InvalidForward);
10202         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
10203         return requested_forward_scid_conv;
10204 }
10205 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
10206         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10207         assert(obj->tag == LDKHTLCDestination_FailedPayment);
10208         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10209         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
10210         return payment_hash_arr;
10211 }
10212 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
10213         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10214         switch(obj->tag) {
10215                 case LDKCOption_HTLCDestinationZ_Some: return 0;
10216                 case LDKCOption_HTLCDestinationZ_None: return 1;
10217                 default: abort();
10218         }
10219 }
10220 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
10221         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10222         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
10223         uint64_t some_ref = tag_ptr(&obj->some, false);
10224         return some_ref;
10225 }
10226 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10227 CHECK(owner->result_ok);
10228         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
10229 }
10230 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
10231         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10232         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
10233         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
10234         uint64_t ret_ref = tag_ptr(ret_copy, true);
10235         return ret_ref;
10236 }
10237
10238 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10239 CHECK(!owner->result_ok);
10240         return DecodeError_clone(&*owner->contents.err);
10241 }
10242 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
10243         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10245         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
10246         uint64_t ret_ref = tag_ptr(ret_copy, true);
10247         return ret_ref;
10248 }
10249
10250 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10251 CHECK(owner->result_ok);
10252         return PaymentFailureReason_clone(&*owner->contents.result);
10253 }
10254 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
10255         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10256         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
10257         return ret_conv;
10258 }
10259
10260 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10261 CHECK(!owner->result_ok);
10262         return DecodeError_clone(&*owner->contents.err);
10263 }
10264 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
10265         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10266         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10267         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
10268         uint64_t ret_ref = tag_ptr(ret_copy, true);
10269         return ret_ref;
10270 }
10271
10272 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
10273         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10274         switch(obj->tag) {
10275                 case LDKCOption_U128Z_Some: return 0;
10276                 case LDKCOption_U128Z_None: return 1;
10277                 default: abort();
10278         }
10279 }
10280 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
10281         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10282         assert(obj->tag == LDKCOption_U128Z_Some);
10283         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
10284         memcpy(some_arr->elems, obj->some.le_bytes, 16);
10285         return some_arr;
10286 }
10287 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
10288         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
10289         for (size_t i = 0; i < ret.datalen; i++) {
10290                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
10291         }
10292         return ret;
10293 }
10294 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
10295         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10296         switch(obj->tag) {
10297                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
10298                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
10299                 default: abort();
10300         }
10301 }
10302 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
10303         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10304         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
10305         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
10306         return some_conv;
10307 }
10308 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
10309         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10310         switch(obj->tag) {
10311                 case LDKBumpTransactionEvent_ChannelClose: return 0;
10312                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
10313                 default: abort();
10314         }
10315 }
10316 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
10317         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10318         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10319         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
10320         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
10321         return claim_id_arr;
10322 }
10323 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) {
10324         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10325         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10326         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
10327         return package_target_feerate_sat_per_1000_weight_conv;
10328 }
10329 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
10330         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10331         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10332         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
10333                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
10334                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
10335         return commitment_tx_arr;
10336 }
10337 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
10338         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10339         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10340         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
10341         return commitment_tx_fee_satoshis_conv;
10342 }
10343 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
10344         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10345         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10346         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
10347                         uint64_t anchor_descriptor_ref = 0;
10348                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
10349                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
10350         return anchor_descriptor_ref;
10351 }
10352 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
10353         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10354         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10355         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
10356                         uint64_tArray pending_htlcs_arr = NULL;
10357                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
10358                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
10359                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
10360                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
10361                                 uint64_t pending_htlcs_conv_24_ref = 0;
10362                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
10363                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
10364                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
10365                         }
10366                         
10367         return pending_htlcs_arr;
10368 }
10369 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
10370         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10371         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10372         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
10373         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
10374         return claim_id_arr;
10375 }
10376 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) {
10377         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10378         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10379         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
10380         return target_feerate_sat_per_1000_weight_conv;
10381 }
10382 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
10383         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10384         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10385         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
10386                         uint64_tArray htlc_descriptors_arr = NULL;
10387                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
10388                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
10389                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
10390                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
10391                                 uint64_t htlc_descriptors_conv_16_ref = 0;
10392                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
10393                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
10394                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
10395                         }
10396                         
10397         return htlc_descriptors_arr;
10398 }
10399 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
10400         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10401         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10402         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
10403         return tx_lock_time_conv;
10404 }
10405 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
10406         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10407         switch(obj->tag) {
10408                 case LDKEvent_FundingGenerationReady: return 0;
10409                 case LDKEvent_PaymentClaimable: return 1;
10410                 case LDKEvent_PaymentClaimed: return 2;
10411                 case LDKEvent_ConnectionNeeded: return 3;
10412                 case LDKEvent_InvoiceRequestFailed: return 4;
10413                 case LDKEvent_PaymentSent: return 5;
10414                 case LDKEvent_PaymentFailed: return 6;
10415                 case LDKEvent_PaymentPathSuccessful: return 7;
10416                 case LDKEvent_PaymentPathFailed: return 8;
10417                 case LDKEvent_ProbeSuccessful: return 9;
10418                 case LDKEvent_ProbeFailed: return 10;
10419                 case LDKEvent_PendingHTLCsForwardable: return 11;
10420                 case LDKEvent_HTLCIntercepted: return 12;
10421                 case LDKEvent_SpendableOutputs: return 13;
10422                 case LDKEvent_PaymentForwarded: return 14;
10423                 case LDKEvent_ChannelPending: return 15;
10424                 case LDKEvent_ChannelReady: return 16;
10425                 case LDKEvent_ChannelClosed: return 17;
10426                 case LDKEvent_DiscardFunding: return 18;
10427                 case LDKEvent_OpenChannelRequest: return 19;
10428                 case LDKEvent_HTLCHandlingFailed: return 20;
10429                 case LDKEvent_BumpTransaction: return 21;
10430                 default: abort();
10431         }
10432 }
10433 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
10434         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10435         assert(obj->tag == LDKEvent_FundingGenerationReady);
10436         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
10437         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
10438         return temporary_channel_id_arr;
10439 }
10440 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
10441         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10442         assert(obj->tag == LDKEvent_FundingGenerationReady);
10443         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10444         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
10445         return counterparty_node_id_arr;
10446 }
10447 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
10448         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10449         assert(obj->tag == LDKEvent_FundingGenerationReady);
10450         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
10451         return channel_value_satoshis_conv;
10452 }
10453 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
10454         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10455         assert(obj->tag == LDKEvent_FundingGenerationReady);
10456         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
10457                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
10458                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
10459         return output_script_arr;
10460 }
10461 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
10462         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10463         assert(obj->tag == LDKEvent_FundingGenerationReady);
10464         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10465         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
10466         return user_channel_id_arr;
10467 }
10468 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
10469         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10470         assert(obj->tag == LDKEvent_PaymentClaimable);
10471         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
10472         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
10473         return receiver_node_id_arr;
10474 }
10475 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
10476         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10477         assert(obj->tag == LDKEvent_PaymentClaimable);
10478         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10479         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
10480         return payment_hash_arr;
10481 }
10482 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
10483         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10484         assert(obj->tag == LDKEvent_PaymentClaimable);
10485         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
10486                         uint64_t onion_fields_ref = 0;
10487                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
10488                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
10489         return onion_fields_ref;
10490 }
10491 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
10492         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10493         assert(obj->tag == LDKEvent_PaymentClaimable);
10494         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
10495         return amount_msat_conv;
10496 }
10497 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
10498         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10499         assert(obj->tag == LDKEvent_PaymentClaimable);
10500         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
10501         return counterparty_skimmed_fee_msat_conv;
10502 }
10503 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
10504         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10505         assert(obj->tag == LDKEvent_PaymentClaimable);
10506         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
10507         return purpose_ref;
10508 }
10509 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
10510         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10511         assert(obj->tag == LDKEvent_PaymentClaimable);
10512         uint64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
10513         return via_channel_id_ref;
10514 }
10515 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
10516         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10517         assert(obj->tag == LDKEvent_PaymentClaimable);
10518         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
10519         return via_user_channel_id_ref;
10520 }
10521 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
10522         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10523         assert(obj->tag == LDKEvent_PaymentClaimable);
10524         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
10525         return claim_deadline_ref;
10526 }
10527 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
10528         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10529         assert(obj->tag == LDKEvent_PaymentClaimed);
10530         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
10531         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
10532         return receiver_node_id_arr;
10533 }
10534 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
10535         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10536         assert(obj->tag == LDKEvent_PaymentClaimed);
10537         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10538         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
10539         return payment_hash_arr;
10540 }
10541 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
10542         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10543         assert(obj->tag == LDKEvent_PaymentClaimed);
10544         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
10545         return amount_msat_conv;
10546 }
10547 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
10548         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10549         assert(obj->tag == LDKEvent_PaymentClaimed);
10550         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
10551         return purpose_ref;
10552 }
10553 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
10554         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10555         assert(obj->tag == LDKEvent_PaymentClaimed);
10556         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
10557                         uint64_tArray htlcs_arr = NULL;
10558                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
10559                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
10560                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
10561                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
10562                                 uint64_t htlcs_conv_13_ref = 0;
10563                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
10564                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
10565                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
10566                         }
10567                         
10568         return htlcs_arr;
10569 }
10570 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
10571         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10572         assert(obj->tag == LDKEvent_PaymentClaimed);
10573         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
10574         return sender_intended_total_msat_ref;
10575 }
10576 int8_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_node_id"))) TS_LDKEvent_ConnectionNeeded_get_node_id(uint64_t ptr) {
10577         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10578         assert(obj->tag == LDKEvent_ConnectionNeeded);
10579         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10580         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
10581         return node_id_arr;
10582 }
10583 uint64_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_addresses"))) TS_LDKEvent_ConnectionNeeded_get_addresses(uint64_t ptr) {
10584         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10585         assert(obj->tag == LDKEvent_ConnectionNeeded);
10586         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
10587                         uint64_tArray addresses_arr = NULL;
10588                         addresses_arr = init_uint64_tArray(addresses_var.datalen, __LINE__);
10589                         uint64_t *addresses_arr_ptr = (uint64_t*)(((uint8_t*)addresses_arr) + 8);
10590                         for (size_t p = 0; p < addresses_var.datalen; p++) {
10591                                 uint64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
10592                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
10593                         }
10594                         
10595         return addresses_arr;
10596 }
10597 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
10598         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10599         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
10600         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10601         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
10602         return payment_id_arr;
10603 }
10604 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
10605         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10606         assert(obj->tag == LDKEvent_PaymentSent);
10607         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
10608         return payment_id_ref;
10609 }
10610 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
10611         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10612         assert(obj->tag == LDKEvent_PaymentSent);
10613         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10614         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
10615         return payment_preimage_arr;
10616 }
10617 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
10618         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10619         assert(obj->tag == LDKEvent_PaymentSent);
10620         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10621         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
10622         return payment_hash_arr;
10623 }
10624 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
10625         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10626         assert(obj->tag == LDKEvent_PaymentSent);
10627         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
10628         return fee_paid_msat_ref;
10629 }
10630 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
10631         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10632         assert(obj->tag == LDKEvent_PaymentFailed);
10633         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10634         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
10635         return payment_id_arr;
10636 }
10637 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
10638         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10639         assert(obj->tag == LDKEvent_PaymentFailed);
10640         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10641         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
10642         return payment_hash_arr;
10643 }
10644 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
10645         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10646         assert(obj->tag == LDKEvent_PaymentFailed);
10647         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
10648         return reason_ref;
10649 }
10650 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
10651         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10652         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
10653         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10654         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
10655         return payment_id_arr;
10656 }
10657 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
10658         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10659         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
10660         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
10661         return payment_hash_ref;
10662 }
10663 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
10664         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10665         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
10666         LDKPath path_var = obj->payment_path_successful.path;
10667                         uint64_t path_ref = 0;
10668                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10669                         path_ref = tag_ptr(path_var.inner, false);
10670         return path_ref;
10671 }
10672 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
10673         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10674         assert(obj->tag == LDKEvent_PaymentPathFailed);
10675         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
10676         return payment_id_ref;
10677 }
10678 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
10679         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10680         assert(obj->tag == LDKEvent_PaymentPathFailed);
10681         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10682         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
10683         return payment_hash_arr;
10684 }
10685 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
10686         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10687         assert(obj->tag == LDKEvent_PaymentPathFailed);
10688         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
10689         return payment_failed_permanently_conv;
10690 }
10691 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
10692         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10693         assert(obj->tag == LDKEvent_PaymentPathFailed);
10694         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
10695         return failure_ref;
10696 }
10697 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
10698         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10699         assert(obj->tag == LDKEvent_PaymentPathFailed);
10700         LDKPath path_var = obj->payment_path_failed.path;
10701                         uint64_t path_ref = 0;
10702                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10703                         path_ref = tag_ptr(path_var.inner, false);
10704         return path_ref;
10705 }
10706 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
10707         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10708         assert(obj->tag == LDKEvent_PaymentPathFailed);
10709         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
10710         return short_channel_id_ref;
10711 }
10712 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
10713         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10714         assert(obj->tag == LDKEvent_ProbeSuccessful);
10715         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10716         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
10717         return payment_id_arr;
10718 }
10719 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
10720         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10721         assert(obj->tag == LDKEvent_ProbeSuccessful);
10722         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10723         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
10724         return payment_hash_arr;
10725 }
10726 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
10727         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10728         assert(obj->tag == LDKEvent_ProbeSuccessful);
10729         LDKPath path_var = obj->probe_successful.path;
10730                         uint64_t path_ref = 0;
10731                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10732                         path_ref = tag_ptr(path_var.inner, false);
10733         return path_ref;
10734 }
10735 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
10736         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10737         assert(obj->tag == LDKEvent_ProbeFailed);
10738         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10739         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
10740         return payment_id_arr;
10741 }
10742 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
10743         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10744         assert(obj->tag == LDKEvent_ProbeFailed);
10745         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10746         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
10747         return payment_hash_arr;
10748 }
10749 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
10750         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10751         assert(obj->tag == LDKEvent_ProbeFailed);
10752         LDKPath path_var = obj->probe_failed.path;
10753                         uint64_t path_ref = 0;
10754                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10755                         path_ref = tag_ptr(path_var.inner, false);
10756         return path_ref;
10757 }
10758 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
10759         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10760         assert(obj->tag == LDKEvent_ProbeFailed);
10761         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
10762         return short_channel_id_ref;
10763 }
10764 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
10765         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10766         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
10767         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
10768         return time_forwardable_conv;
10769 }
10770 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
10771         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10772         assert(obj->tag == LDKEvent_HTLCIntercepted);
10773         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
10774         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
10775         return intercept_id_arr;
10776 }
10777 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
10778         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10779         assert(obj->tag == LDKEvent_HTLCIntercepted);
10780         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
10781         return requested_next_hop_scid_conv;
10782 }
10783 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
10784         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10785         assert(obj->tag == LDKEvent_HTLCIntercepted);
10786         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10787         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
10788         return payment_hash_arr;
10789 }
10790 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
10791         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10792         assert(obj->tag == LDKEvent_HTLCIntercepted);
10793         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
10794         return inbound_amount_msat_conv;
10795 }
10796 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
10797         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10798         assert(obj->tag == LDKEvent_HTLCIntercepted);
10799         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
10800         return expected_outbound_amount_msat_conv;
10801 }
10802 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
10803         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10804         assert(obj->tag == LDKEvent_SpendableOutputs);
10805         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
10806                         uint64_tArray outputs_arr = NULL;
10807                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
10808                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
10809                         for (size_t b = 0; b < outputs_var.datalen; b++) {
10810                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
10811                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
10812                         }
10813                         
10814         return outputs_arr;
10815 }
10816 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
10817         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10818         assert(obj->tag == LDKEvent_SpendableOutputs);
10819         uint64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
10820         return channel_id_ref;
10821 }
10822 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
10823         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10824         assert(obj->tag == LDKEvent_PaymentForwarded);
10825         uint64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
10826         return prev_channel_id_ref;
10827 }
10828 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
10829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10830         assert(obj->tag == LDKEvent_PaymentForwarded);
10831         uint64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
10832         return next_channel_id_ref;
10833 }
10834 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
10835         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10836         assert(obj->tag == LDKEvent_PaymentForwarded);
10837         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
10838         return fee_earned_msat_ref;
10839 }
10840 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
10841         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10842         assert(obj->tag == LDKEvent_PaymentForwarded);
10843         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
10844         return claim_from_onchain_tx_conv;
10845 }
10846 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
10847         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10848         assert(obj->tag == LDKEvent_PaymentForwarded);
10849         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
10850         return outbound_amount_forwarded_msat_ref;
10851 }
10852 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
10853         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10854         assert(obj->tag == LDKEvent_ChannelPending);
10855         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10856         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
10857         return channel_id_arr;
10858 }
10859 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
10860         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10861         assert(obj->tag == LDKEvent_ChannelPending);
10862         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10863         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
10864         return user_channel_id_arr;
10865 }
10866 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
10867         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10868         assert(obj->tag == LDKEvent_ChannelPending);
10869         uint64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
10870         return former_temporary_channel_id_ref;
10871 }
10872 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
10873         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10874         assert(obj->tag == LDKEvent_ChannelPending);
10875         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10876         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
10877         return counterparty_node_id_arr;
10878 }
10879 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
10880         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10881         assert(obj->tag == LDKEvent_ChannelPending);
10882         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
10883                         uint64_t funding_txo_ref = 0;
10884                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
10885                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
10886         return funding_txo_ref;
10887 }
10888 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
10889         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10890         assert(obj->tag == LDKEvent_ChannelReady);
10891         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10892         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
10893         return channel_id_arr;
10894 }
10895 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
10896         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10897         assert(obj->tag == LDKEvent_ChannelReady);
10898         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10899         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
10900         return user_channel_id_arr;
10901 }
10902 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
10903         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10904         assert(obj->tag == LDKEvent_ChannelReady);
10905         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10906         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
10907         return counterparty_node_id_arr;
10908 }
10909 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
10910         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10911         assert(obj->tag == LDKEvent_ChannelReady);
10912         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
10913                         uint64_t channel_type_ref = 0;
10914                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10915                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10916         return channel_type_ref;
10917 }
10918 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
10919         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10920         assert(obj->tag == LDKEvent_ChannelClosed);
10921         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10922         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
10923         return channel_id_arr;
10924 }
10925 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
10926         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10927         assert(obj->tag == LDKEvent_ChannelClosed);
10928         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10929         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
10930         return user_channel_id_arr;
10931 }
10932 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
10933         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10934         assert(obj->tag == LDKEvent_ChannelClosed);
10935         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
10936         return reason_ref;
10937 }
10938 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
10939         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10940         assert(obj->tag == LDKEvent_ChannelClosed);
10941         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10942         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
10943         return counterparty_node_id_arr;
10944 }
10945 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
10946         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10947         assert(obj->tag == LDKEvent_ChannelClosed);
10948         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
10949         return channel_capacity_sats_ref;
10950 }
10951 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_funding_txo"))) TS_LDKEvent_ChannelClosed_get_channel_funding_txo(uint64_t ptr) {
10952         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10953         assert(obj->tag == LDKEvent_ChannelClosed);
10954         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
10955                         uint64_t channel_funding_txo_ref = 0;
10956                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
10957                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
10958         return channel_funding_txo_ref;
10959 }
10960 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
10961         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10962         assert(obj->tag == LDKEvent_DiscardFunding);
10963         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10964         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
10965         return channel_id_arr;
10966 }
10967 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
10968         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10969         assert(obj->tag == LDKEvent_DiscardFunding);
10970         LDKTransaction transaction_var = obj->discard_funding.transaction;
10971                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
10972                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
10973         return transaction_arr;
10974 }
10975 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
10976         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10977         assert(obj->tag == LDKEvent_OpenChannelRequest);
10978         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
10979         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
10980         return temporary_channel_id_arr;
10981 }
10982 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
10983         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10984         assert(obj->tag == LDKEvent_OpenChannelRequest);
10985         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10986         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
10987         return counterparty_node_id_arr;
10988 }
10989 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
10990         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10991         assert(obj->tag == LDKEvent_OpenChannelRequest);
10992         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
10993         return funding_satoshis_conv;
10994 }
10995 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
10996         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10997         assert(obj->tag == LDKEvent_OpenChannelRequest);
10998         int64_t push_msat_conv = obj->open_channel_request.push_msat;
10999         return push_msat_conv;
11000 }
11001 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
11002         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11003         assert(obj->tag == LDKEvent_OpenChannelRequest);
11004         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11005                         uint64_t channel_type_ref = 0;
11006                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11007                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11008         return channel_type_ref;
11009 }
11010 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
11011         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11012         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11013         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
11014         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
11015         return prev_channel_id_arr;
11016 }
11017 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
11018         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11019         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11020         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11021         return failed_next_destination_ref;
11022 }
11023 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
11024         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11025         assert(obj->tag == LDKEvent_BumpTransaction);
11026         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11027         return bump_transaction_ref;
11028 }
11029 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
11030         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11031         switch(obj->tag) {
11032                 case LDKCOption_EventZ_Some: return 0;
11033                 case LDKCOption_EventZ_None: return 1;
11034                 default: abort();
11035         }
11036 }
11037 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
11038         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11039         assert(obj->tag == LDKCOption_EventZ_Some);
11040         uint64_t some_ref = tag_ptr(&obj->some, false);
11041         return some_ref;
11042 }
11043 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11044 CHECK(owner->result_ok);
11045         return COption_EventZ_clone(&*owner->contents.result);
11046 }
11047 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
11048         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11049         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11050         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11051         uint64_t ret_ref = tag_ptr(ret_copy, true);
11052         return ret_ref;
11053 }
11054
11055 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11056 CHECK(!owner->result_ok);
11057         return DecodeError_clone(&*owner->contents.err);
11058 }
11059 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
11060         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11061         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11062         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
11063         uint64_t ret_ref = tag_ptr(ret_copy, true);
11064         return ret_ref;
11065 }
11066
11067 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
11068         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11069         switch(obj->tag) {
11070                 case LDKBolt11ParseError_Bech32Error: return 0;
11071                 case LDKBolt11ParseError_ParseAmountError: return 1;
11072                 case LDKBolt11ParseError_MalformedSignature: return 2;
11073                 case LDKBolt11ParseError_BadPrefix: return 3;
11074                 case LDKBolt11ParseError_UnknownCurrency: return 4;
11075                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
11076                 case LDKBolt11ParseError_MalformedHRP: return 6;
11077                 case LDKBolt11ParseError_TooShortDataPart: return 7;
11078                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
11079                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
11080                 case LDKBolt11ParseError_PaddingError: return 10;
11081                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
11082                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
11083                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
11084                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
11085                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
11086                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
11087                 case LDKBolt11ParseError_Skip: return 17;
11088                 default: abort();
11089         }
11090 }
11091 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
11092         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11093         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
11094         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
11095         return bech32_error_ref;
11096 }
11097 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
11098         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11099         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
11100         /*obj->parse_amount_error*/
11101         return 0;
11102 }
11103 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
11104         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11105         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
11106         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
11107         return malformed_signature_conv;
11108 }
11109 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
11110         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11111         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
11112         /*obj->description_decode_error*/
11113         return 0;
11114 }
11115 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
11116         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11117         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
11118         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
11119                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
11120         return invalid_slice_length_conv;
11121 }
11122 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11123 CHECK(owner->result_ok);
11124         return SiPrefix_clone(&*owner->contents.result);
11125 }
11126 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
11127         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11128         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
11129         return ret_conv;
11130 }
11131
11132 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11133 CHECK(!owner->result_ok);
11134         return Bolt11ParseError_clone(&*owner->contents.err);
11135 }
11136 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
11137         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11138         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11139         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
11140         uint64_t ret_ref = tag_ptr(ret_copy, true);
11141         return ret_ref;
11142 }
11143
11144 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
11145         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11146         switch(obj->tag) {
11147                 case LDKParseOrSemanticError_ParseError: return 0;
11148                 case LDKParseOrSemanticError_SemanticError: return 1;
11149                 default: abort();
11150         }
11151 }
11152 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
11153         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11154         assert(obj->tag == LDKParseOrSemanticError_ParseError);
11155         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
11156         return parse_error_ref;
11157 }
11158 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
11159         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11160         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
11161         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
11162         return semantic_error_conv;
11163 }
11164 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11165         LDKBolt11Invoice ret = *owner->contents.result;
11166         ret.is_owned = false;
11167         return ret;
11168 }
11169 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
11170         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11171         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
11172         uint64_t ret_ref = 0;
11173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11175         return ret_ref;
11176 }
11177
11178 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11179 CHECK(!owner->result_ok);
11180         return ParseOrSemanticError_clone(&*owner->contents.err);
11181 }
11182 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
11183         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11184         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
11185         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
11186         uint64_t ret_ref = tag_ptr(ret_copy, true);
11187         return ret_ref;
11188 }
11189
11190 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11191         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
11192         ret.is_owned = false;
11193         return ret;
11194 }
11195 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
11196         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11197         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
11198         uint64_t ret_ref = 0;
11199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11201         return ret_ref;
11202 }
11203
11204 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11205 CHECK(!owner->result_ok);
11206         return Bolt11ParseError_clone(&*owner->contents.err);
11207 }
11208 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
11209         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11210         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11211         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
11212         uint64_t ret_ref = tag_ptr(ret_copy, true);
11213         return ret_ref;
11214 }
11215
11216 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11217         LDKRawBolt11Invoice ret = owner->a;
11218         ret.is_owned = false;
11219         return ret;
11220 }
11221 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
11222         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11223         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
11224         uint64_t ret_ref = 0;
11225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11227         return ret_ref;
11228 }
11229
11230 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11231         return ThirtyTwoBytes_clone(&owner->b);
11232 }
11233 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
11234         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11235         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11236         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
11237         return ret_arr;
11238 }
11239
11240 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11241         LDKBolt11InvoiceSignature ret = owner->c;
11242         ret.is_owned = false;
11243         return ret;
11244 }
11245 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
11246         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11247         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
11248         uint64_t ret_ref = 0;
11249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11251         return ret_ref;
11252 }
11253
11254 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11255         LDKPayeePubKey ret = *owner->contents.result;
11256         ret.is_owned = false;
11257         return ret;
11258 }
11259 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
11260         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11261         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
11262         uint64_t ret_ref = 0;
11263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11265         return ret_ref;
11266 }
11267
11268 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11269 CHECK(!owner->result_ok);
11270         return *owner->contents.err;
11271 }
11272 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
11273         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11274         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
11275         return ret_conv;
11276 }
11277
11278 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
11279         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
11280         for (size_t i = 0; i < ret.datalen; i++) {
11281                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
11282         }
11283         return ret;
11284 }
11285 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11286         LDKPositiveTimestamp ret = *owner->contents.result;
11287         ret.is_owned = false;
11288         return ret;
11289 }
11290 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
11291         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11292         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
11293         uint64_t ret_ref = 0;
11294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11296         return ret_ref;
11297 }
11298
11299 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11300 CHECK(!owner->result_ok);
11301         return CreationError_clone(&*owner->contents.err);
11302 }
11303 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
11304         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11305         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
11306         return ret_conv;
11307 }
11308
11309 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11310 CHECK(owner->result_ok);
11311         return *owner->contents.result;
11312 }
11313 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
11314         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11315         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
11316 }
11317
11318 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11319 CHECK(!owner->result_ok);
11320         return Bolt11SemanticError_clone(&*owner->contents.err);
11321 }
11322 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
11323         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11324         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
11325         return ret_conv;
11326 }
11327
11328 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11329         LDKBolt11Invoice ret = *owner->contents.result;
11330         ret.is_owned = false;
11331         return ret;
11332 }
11333 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
11334         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11335         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
11336         uint64_t ret_ref = 0;
11337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11339         return ret_ref;
11340 }
11341
11342 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11343 CHECK(!owner->result_ok);
11344         return Bolt11SemanticError_clone(&*owner->contents.err);
11345 }
11346 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
11347         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11348         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
11349         return ret_conv;
11350 }
11351
11352 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11353         LDKDescription ret = *owner->contents.result;
11354         ret.is_owned = false;
11355         return ret;
11356 }
11357 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
11358         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
11359         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
11360         uint64_t ret_ref = 0;
11361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11363         return ret_ref;
11364 }
11365
11366 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11367 CHECK(!owner->result_ok);
11368         return CreationError_clone(&*owner->contents.err);
11369 }
11370 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
11371         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
11372         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
11373         return ret_conv;
11374 }
11375
11376 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
11377         LDKPrivateRoute ret = *owner->contents.result;
11378         ret.is_owned = false;
11379         return ret;
11380 }
11381 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
11382         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
11383         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
11384         uint64_t ret_ref = 0;
11385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11387         return ret_ref;
11388 }
11389
11390 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
11391 CHECK(!owner->result_ok);
11392         return CreationError_clone(&*owner->contents.err);
11393 }
11394 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
11395         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
11396         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
11397         return ret_conv;
11398 }
11399
11400 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
11401         LDKOutPoint ret = *owner->contents.result;
11402         ret.is_owned = false;
11403         return ret;
11404 }
11405 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
11406         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
11407         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
11408         uint64_t ret_ref = 0;
11409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11411         return ret_ref;
11412 }
11413
11414 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
11415 CHECK(!owner->result_ok);
11416         return DecodeError_clone(&*owner->contents.err);
11417 }
11418 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
11419         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
11420         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11421         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
11422         uint64_t ret_ref = tag_ptr(ret_copy, true);
11423         return ret_ref;
11424 }
11425
11426 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
11427         LDKBigSize ret = *owner->contents.result;
11428         ret.is_owned = false;
11429         return ret;
11430 }
11431 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
11432         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
11433         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
11434         uint64_t ret_ref = 0;
11435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11437         return ret_ref;
11438 }
11439
11440 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
11441 CHECK(!owner->result_ok);
11442         return DecodeError_clone(&*owner->contents.err);
11443 }
11444 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
11445         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
11446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11447         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
11448         uint64_t ret_ref = tag_ptr(ret_copy, true);
11449         return ret_ref;
11450 }
11451
11452 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
11453         LDKHostname ret = *owner->contents.result;
11454         ret.is_owned = false;
11455         return ret;
11456 }
11457 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
11458         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
11459         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
11460         uint64_t ret_ref = 0;
11461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11463         return ret_ref;
11464 }
11465
11466 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
11467 CHECK(!owner->result_ok);
11468         return DecodeError_clone(&*owner->contents.err);
11469 }
11470 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
11471         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
11472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11473         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
11474         uint64_t ret_ref = tag_ptr(ret_copy, true);
11475         return ret_ref;
11476 }
11477
11478 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
11479         LDKTransactionU16LenLimited ret = *owner->contents.result;
11480         ret.is_owned = false;
11481         return ret;
11482 }
11483 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
11484         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
11485         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
11486         uint64_t ret_ref = 0;
11487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11489         return ret_ref;
11490 }
11491
11492 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
11493 CHECK(!owner->result_ok);
11494         return *owner->contents.err;
11495 }
11496 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
11497         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
11498         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
11499 }
11500
11501 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
11502         LDKTransactionU16LenLimited ret = *owner->contents.result;
11503         ret.is_owned = false;
11504         return ret;
11505 }
11506 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
11507         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
11508         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
11509         uint64_t ret_ref = 0;
11510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11512         return ret_ref;
11513 }
11514
11515 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
11516 CHECK(!owner->result_ok);
11517         return DecodeError_clone(&*owner->contents.err);
11518 }
11519 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
11520         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
11521         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11522         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
11523         uint64_t ret_ref = tag_ptr(ret_copy, true);
11524         return ret_ref;
11525 }
11526
11527 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
11528         LDKUntrustedString ret = *owner->contents.result;
11529         ret.is_owned = false;
11530         return ret;
11531 }
11532 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
11533         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
11534         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
11535         uint64_t ret_ref = 0;
11536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11538         return ret_ref;
11539 }
11540
11541 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
11542 CHECK(!owner->result_ok);
11543         return DecodeError_clone(&*owner->contents.err);
11544 }
11545 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
11546         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
11547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11548         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
11549         uint64_t ret_ref = tag_ptr(ret_copy, true);
11550         return ret_ref;
11551 }
11552
11553 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
11554         return ThirtyTwoBytes_clone(&owner->a);
11555 }
11556 int8_tArray  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_a"))) TS_C2Tuple__u832u16Z_get_a(uint64_t owner) {
11557         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
11558         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11559         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
11560         return ret_arr;
11561 }
11562
11563 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
11564         return owner->b;
11565 }
11566 int16_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_b"))) TS_C2Tuple__u832u16Z_get_b(uint64_t owner) {
11567         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
11568         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
11569         return ret_conv;
11570 }
11571
11572 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
11573         LDKPaymentRelay ret = *owner->contents.result;
11574         ret.is_owned = false;
11575         return ret;
11576 }
11577 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
11578         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
11579         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
11580         uint64_t ret_ref = 0;
11581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11583         return ret_ref;
11584 }
11585
11586 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
11587 CHECK(!owner->result_ok);
11588         return DecodeError_clone(&*owner->contents.err);
11589 }
11590 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
11591         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
11592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11593         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
11594         uint64_t ret_ref = tag_ptr(ret_copy, true);
11595         return ret_ref;
11596 }
11597
11598 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
11599         LDKPaymentConstraints ret = *owner->contents.result;
11600         ret.is_owned = false;
11601         return ret;
11602 }
11603 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
11604         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
11605         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
11606         uint64_t ret_ref = 0;
11607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11609         return ret_ref;
11610 }
11611
11612 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
11613 CHECK(!owner->result_ok);
11614         return DecodeError_clone(&*owner->contents.err);
11615 }
11616 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
11617         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
11618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11619         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
11620         uint64_t ret_ref = tag_ptr(ret_copy, true);
11621         return ret_ref;
11622 }
11623
11624 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
11625         return ThirtyTwoBytes_clone(&owner->a);
11626 }
11627 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(uint64_t owner) {
11628         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
11629         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11630         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
11631         return ret_arr;
11632 }
11633
11634 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
11635         LDKRecipientOnionFields ret = owner->b;
11636         ret.is_owned = false;
11637         return ret;
11638 }
11639 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(uint64_t owner) {
11640         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
11641         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
11642         uint64_t ret_ref = 0;
11643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11645         return ret_ref;
11646 }
11647
11648 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
11649         LDKRouteParameters ret = owner->c;
11650         ret.is_owned = false;
11651         return ret;
11652 }
11653 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(uint64_t owner) {
11654         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
11655         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
11656         uint64_t ret_ref = 0;
11657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11659         return ret_ref;
11660 }
11661
11662 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
11663 CHECK(owner->result_ok);
11664         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
11665 }
11666 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(uint64_t owner) {
11667         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
11668         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
11669         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
11670         return tag_ptr(ret_conv, true);
11671 }
11672
11673 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
11674 CHECK(!owner->result_ok);
11675         return *owner->contents.err;
11676 }
11677 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(uint64_t owner) {
11678         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
11679         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
11680 }
11681
11682 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
11683 CHECK(owner->result_ok);
11684         return *owner->contents.result;
11685 }
11686 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
11687         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
11688         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
11689         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11690         return ret_conv;
11691 }
11692
11693 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
11694 CHECK(!owner->result_ok);
11695         return *owner->contents.err;
11696 }
11697 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
11698         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
11699         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
11700         return ret_conv;
11701 }
11702
11703 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
11704         return owner->a;
11705 }
11706 int8_tArray  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(uint64_t owner) {
11707         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
11708         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
11709         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
11710         return ret_arr;
11711 }
11712
11713 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
11714         LDKOnionMessage ret = owner->b;
11715         ret.is_owned = false;
11716         return ret;
11717 }
11718 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(uint64_t owner) {
11719         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
11720         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
11721         uint64_t ret_ref = 0;
11722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11724         return ret_ref;
11725 }
11726
11727 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
11728         return COption_CVec_SocketAddressZZ_clone(&owner->c);
11729 }
11730 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(uint64_t owner) {
11731         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
11732         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
11733         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
11734         uint64_t ret_ref = tag_ptr(ret_copy, true);
11735         return ret_ref;
11736 }
11737
11738 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
11739         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
11740         switch(obj->tag) {
11741                 case LDKSendError_Secp256k1: return 0;
11742                 case LDKSendError_TooBigPacket: return 1;
11743                 case LDKSendError_TooFewBlindedHops: return 2;
11744                 case LDKSendError_InvalidFirstHop: return 3;
11745                 case LDKSendError_PathNotFound: return 4;
11746                 case LDKSendError_InvalidMessage: return 5;
11747                 case LDKSendError_BufferFull: return 6;
11748                 case LDKSendError_GetNodeIdFailed: return 7;
11749                 case LDKSendError_BlindedPathAdvanceFailed: return 8;
11750                 default: abort();
11751         }
11752 }
11753 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
11754         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
11755         assert(obj->tag == LDKSendError_Secp256k1);
11756         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
11757         return secp256k1_conv;
11758 }
11759 int8_tArray __attribute__((export_name("TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop"))) TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop(uint64_t ptr) {
11760         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
11761         assert(obj->tag == LDKSendError_InvalidFirstHop);
11762         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
11763         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
11764         return invalid_first_hop_arr;
11765 }
11766 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
11767 CHECK(owner->result_ok);
11768         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
11769 }
11770 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(uint64_t owner) {
11771         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
11772         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
11773         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
11774         return tag_ptr(ret_conv, true);
11775 }
11776
11777 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
11778 CHECK(!owner->result_ok);
11779         return SendError_clone(&*owner->contents.err);
11780 }
11781 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(uint64_t owner) {
11782         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
11783         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11784         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
11785         uint64_t ret_ref = tag_ptr(ret_copy, true);
11786         return ret_ref;
11787 }
11788
11789 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11790         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11791         switch(obj->tag) {
11792                 case LDKParsedOnionMessageContents_Offers: return 0;
11793                 case LDKParsedOnionMessageContents_Custom: return 1;
11794                 default: abort();
11795         }
11796 }
11797 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
11798         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11799         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
11800         uint64_t offers_ref = tag_ptr(&obj->offers, false);
11801         return offers_ref;
11802 }
11803 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11804         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11805         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
11806         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11807         *custom_ret = OnionMessageContents_clone(&obj->custom);
11808         return tag_ptr(custom_ret, true);
11809 }
11810 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
11811         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11812         switch(obj->tag) {
11813                 case LDKPeeledOnion_Forward: return 0;
11814                 case LDKPeeledOnion_Receive: return 1;
11815                 default: abort();
11816         }
11817 }
11818 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
11819         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11820         assert(obj->tag == LDKPeeledOnion_Forward);
11821         int8_tArray _0_arr = init_int8_tArray(33, __LINE__);
11822         memcpy(_0_arr->elems, obj->forward._0.compressed_form, 33);
11823         return _0_arr;
11824 }
11825 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
11826         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11827         assert(obj->tag == LDKPeeledOnion_Forward);
11828         LDKOnionMessage _1_var = obj->forward._1;
11829                         uint64_t _1_ref = 0;
11830                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
11831                         _1_ref = tag_ptr(_1_var.inner, false);
11832         return _1_ref;
11833 }
11834 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
11835         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11836         assert(obj->tag == LDKPeeledOnion_Receive);
11837         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
11838         return _0_ref;
11839 }
11840 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
11841         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11842         assert(obj->tag == LDKPeeledOnion_Receive);
11843         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
11844         memcpy(_1_arr->elems, obj->receive._1.data, 32);
11845         return _1_arr;
11846 }
11847 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
11848         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11849         assert(obj->tag == LDKPeeledOnion_Receive);
11850         LDKBlindedPath _2_var = obj->receive._2;
11851                         uint64_t _2_ref = 0;
11852                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
11853                         _2_ref = tag_ptr(_2_var.inner, false);
11854         return _2_ref;
11855 }
11856 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11857 CHECK(owner->result_ok);
11858         return PeeledOnion_clone(&*owner->contents.result);
11859 }
11860 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
11861         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11862         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
11863         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
11864         uint64_t ret_ref = tag_ptr(ret_copy, true);
11865         return ret_ref;
11866 }
11867
11868 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11869 CHECK(!owner->result_ok);
11870         return *owner->contents.err;
11871 }
11872 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
11873         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11874         CResult_PeeledOnionNoneZ_get_err(owner_conv);
11875 }
11876
11877 uint32_t __attribute__((export_name("TS_LDKSendSuccess_ty_from_ptr"))) TS_LDKSendSuccess_ty_from_ptr(uint64_t ptr) {
11878         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
11879         switch(obj->tag) {
11880                 case LDKSendSuccess_Buffered: return 0;
11881                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
11882                 default: abort();
11883         }
11884 }
11885 int8_tArray __attribute__((export_name("TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection"))) TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(uint64_t ptr) {
11886         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
11887         assert(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
11888         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
11889         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
11890         return buffered_awaiting_connection_arr;
11891 }
11892 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
11893 CHECK(owner->result_ok);
11894         return SendSuccess_clone(&*owner->contents.result);
11895 }
11896 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_ok"))) TS_CResult_SendSuccessSendErrorZ_get_ok(uint64_t owner) {
11897         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
11898         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
11899         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
11900         uint64_t ret_ref = tag_ptr(ret_copy, true);
11901         return ret_ref;
11902 }
11903
11904 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
11905 CHECK(!owner->result_ok);
11906         return SendError_clone(&*owner->contents.err);
11907 }
11908 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_err"))) TS_CResult_SendSuccessSendErrorZ_get_err(uint64_t owner) {
11909         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
11910         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11911         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
11912         uint64_t ret_ref = tag_ptr(ret_copy, true);
11913         return ret_ref;
11914 }
11915
11916 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11917         LDKBlindedPath ret = *owner->contents.result;
11918         ret.is_owned = false;
11919         return ret;
11920 }
11921 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
11922         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11923         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
11924         uint64_t ret_ref = 0;
11925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11927         return ret_ref;
11928 }
11929
11930 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11931 CHECK(!owner->result_ok);
11932         return *owner->contents.err;
11933 }
11934 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
11935         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11936         CResult_BlindedPathNoneZ_get_err(owner_conv);
11937 }
11938
11939 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11940 CHECK(owner->result_ok);
11941         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
11942 }
11943 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
11944         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11945         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
11946         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
11947         return tag_ptr(ret_conv, true);
11948 }
11949
11950 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11951 CHECK(!owner->result_ok);
11952         return *owner->contents.err;
11953 }
11954 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
11955         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11956         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
11957 }
11958
11959 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
11960         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
11961         for (size_t i = 0; i < ret.datalen; i++) {
11962                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
11963         }
11964         return ret;
11965 }
11966 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11967         LDKBlindedPath ret = *owner->contents.result;
11968         ret.is_owned = false;
11969         return ret;
11970 }
11971 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
11972         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11973         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
11974         uint64_t ret_ref = 0;
11975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11977         return ret_ref;
11978 }
11979
11980 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11981 CHECK(!owner->result_ok);
11982         return DecodeError_clone(&*owner->contents.err);
11983 }
11984 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
11985         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11986         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11987         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
11988         uint64_t ret_ref = tag_ptr(ret_copy, true);
11989         return ret_ref;
11990 }
11991
11992 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
11993         LDKBlindedHop ret = *owner->contents.result;
11994         ret.is_owned = false;
11995         return ret;
11996 }
11997 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
11998         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
11999         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
12000         uint64_t ret_ref = 0;
12001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12003         return ret_ref;
12004 }
12005
12006 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12007 CHECK(!owner->result_ok);
12008         return DecodeError_clone(&*owner->contents.err);
12009 }
12010 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
12011         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12012         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12013         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
12014         uint64_t ret_ref = tag_ptr(ret_copy, true);
12015         return ret_ref;
12016 }
12017
12018 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12019         LDKInvoiceError ret = *owner->contents.result;
12020         ret.is_owned = false;
12021         return ret;
12022 }
12023 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
12024         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12025         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
12026         uint64_t ret_ref = 0;
12027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12029         return ret_ref;
12030 }
12031
12032 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12033 CHECK(!owner->result_ok);
12034         return DecodeError_clone(&*owner->contents.err);
12035 }
12036 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
12037         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12038         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12039         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
12040         uint64_t ret_ref = tag_ptr(ret_copy, true);
12041         return ret_ref;
12042 }
12043
12044 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12045         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
12046         ret.is_owned = false;
12047         return ret;
12048 }
12049 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(uint64_t owner) {
12050         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12051         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
12052         uint64_t ret_ref = 0;
12053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12055         return ret_ref;
12056 }
12057
12058 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12059 CHECK(!owner->result_ok);
12060         return DecodeError_clone(&*owner->contents.err);
12061 }
12062 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(uint64_t owner) {
12063         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12064         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12065         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
12066         uint64_t ret_ref = tag_ptr(ret_copy, true);
12067         return ret_ref;
12068 }
12069
12070 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12071         LDKDelayedPaymentKey ret = *owner->contents.result;
12072         ret.is_owned = false;
12073         return ret;
12074 }
12075 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(uint64_t owner) {
12076         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12077         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
12078         uint64_t ret_ref = 0;
12079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12081         return ret_ref;
12082 }
12083
12084 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12085 CHECK(!owner->result_ok);
12086         return DecodeError_clone(&*owner->contents.err);
12087 }
12088 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(uint64_t owner) {
12089         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12090         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12091         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
12092         uint64_t ret_ref = tag_ptr(ret_copy, true);
12093         return ret_ref;
12094 }
12095
12096 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12097         LDKHtlcBasepoint ret = *owner->contents.result;
12098         ret.is_owned = false;
12099         return ret;
12100 }
12101 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_ok(uint64_t owner) {
12102         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12103         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
12104         uint64_t ret_ref = 0;
12105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12107         return ret_ref;
12108 }
12109
12110 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12111 CHECK(!owner->result_ok);
12112         return DecodeError_clone(&*owner->contents.err);
12113 }
12114 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_err(uint64_t owner) {
12115         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12116         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12117         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
12118         uint64_t ret_ref = tag_ptr(ret_copy, true);
12119         return ret_ref;
12120 }
12121
12122 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12123         LDKHtlcKey ret = *owner->contents.result;
12124         ret.is_owned = false;
12125         return ret;
12126 }
12127 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_get_ok(uint64_t owner) {
12128         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12129         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
12130         uint64_t ret_ref = 0;
12131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12133         return ret_ref;
12134 }
12135
12136 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12137 CHECK(!owner->result_ok);
12138         return DecodeError_clone(&*owner->contents.err);
12139 }
12140 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_err"))) TS_CResult_HtlcKeyDecodeErrorZ_get_err(uint64_t owner) {
12141         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12142         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12143         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
12144         uint64_t ret_ref = tag_ptr(ret_copy, true);
12145         return ret_ref;
12146 }
12147
12148 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12149         LDKRevocationBasepoint ret = *owner->contents.result;
12150         ret.is_owned = false;
12151         return ret;
12152 }
12153 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_ok(uint64_t owner) {
12154         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12155         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
12156         uint64_t ret_ref = 0;
12157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12159         return ret_ref;
12160 }
12161
12162 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12163 CHECK(!owner->result_ok);
12164         return DecodeError_clone(&*owner->contents.err);
12165 }
12166 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_err(uint64_t owner) {
12167         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12168         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12169         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
12170         uint64_t ret_ref = tag_ptr(ret_copy, true);
12171         return ret_ref;
12172 }
12173
12174 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12175         LDKRevocationKey ret = *owner->contents.result;
12176         ret.is_owned = false;
12177         return ret;
12178 }
12179 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_get_ok(uint64_t owner) {
12180         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12181         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
12182         uint64_t ret_ref = 0;
12183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12185         return ret_ref;
12186 }
12187
12188 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12189 CHECK(!owner->result_ok);
12190         return DecodeError_clone(&*owner->contents.err);
12191 }
12192 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_err"))) TS_CResult_RevocationKeyDecodeErrorZ_get_err(uint64_t owner) {
12193         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12195         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
12196         uint64_t ret_ref = tag_ptr(ret_copy, true);
12197         return ret_ref;
12198 }
12199
12200 typedef struct LDKFilter_JCalls {
12201         atomic_size_t refcnt;
12202         uint32_t instance_ptr;
12203 } LDKFilter_JCalls;
12204 static void LDKFilter_JCalls_free(void* this_arg) {
12205         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12206         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12207                 FREE(j_calls);
12208         }
12209 }
12210 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
12211         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12212         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12213         memcpy(txid_arr->elems, *txid, 32);
12214         LDKu8slice script_pubkey_var = script_pubkey;
12215         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
12216         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
12217         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
12218 }
12219 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
12220         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12221         LDKWatchedOutput output_var = output;
12222         uint64_t output_ref = 0;
12223         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
12224         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
12225         js_invoke_function_buuuuu(j_calls->instance_ptr, 48, output_ref, 0, 0, 0, 0, 0);
12226 }
12227 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
12228         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
12229         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12230 }
12231 static inline LDKFilter LDKFilter_init (JSValue o) {
12232         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
12233         atomic_init(&calls->refcnt, 1);
12234         calls->instance_ptr = o;
12235
12236         LDKFilter ret = {
12237                 .this_arg = (void*) calls,
12238                 .register_tx = register_tx_LDKFilter_jcall,
12239                 .register_output = register_output_LDKFilter_jcall,
12240                 .free = LDKFilter_JCalls_free,
12241         };
12242         return ret;
12243 }
12244 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
12245         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12246         *res_ptr = LDKFilter_init(o);
12247         return tag_ptr(res_ptr, true);
12248 }
12249 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
12250         void* this_arg_ptr = untag_ptr(this_arg);
12251         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12252         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12253         uint8_t txid_arr[32];
12254         CHECK(txid->arr_len == 32);
12255         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12256         uint8_t (*txid_ref)[32] = &txid_arr;
12257         LDKu8slice script_pubkey_ref;
12258         script_pubkey_ref.datalen = script_pubkey->arr_len;
12259         script_pubkey_ref.data = script_pubkey->elems;
12260         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
12261         FREE(script_pubkey);
12262 }
12263
12264 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
12265         void* this_arg_ptr = untag_ptr(this_arg);
12266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12267         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12268         LDKWatchedOutput output_conv;
12269         output_conv.inner = untag_ptr(output);
12270         output_conv.is_owned = ptr_is_owned(output);
12271         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
12272         output_conv = WatchedOutput_clone(&output_conv);
12273         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
12274 }
12275
12276 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
12277         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12278         switch(obj->tag) {
12279                 case LDKCOption_FilterZ_Some: return 0;
12280                 case LDKCOption_FilterZ_None: return 1;
12281                 default: abort();
12282         }
12283 }
12284 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
12285         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12286         assert(obj->tag == LDKCOption_FilterZ_Some);
12287         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
12288         *some_ret = obj->some;
12289                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
12290                         if ((*some_ret).free == LDKFilter_JCalls_free) {
12291                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12292                                 LDKFilter_JCalls_cloned(&(*some_ret));
12293                         }
12294         return tag_ptr(some_ret, true);
12295 }
12296 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12297         LDKLockedChannelMonitor ret = *owner->contents.result;
12298         ret.is_owned = false;
12299         return ret;
12300 }
12301 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
12302         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12303         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
12304         uint64_t ret_ref = 0;
12305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12307         return ret_ref;
12308 }
12309
12310 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12311 CHECK(!owner->result_ok);
12312         return *owner->contents.err;
12313 }
12314 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
12315         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12316         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
12317 }
12318
12319 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
12320         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
12321         for (size_t i = 0; i < ret.datalen; i++) {
12322                 ret.data[i] = OutPoint_clone(&orig->data[i]);
12323         }
12324         return ret;
12325 }
12326 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
12327         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
12328         for (size_t i = 0; i < ret.datalen; i++) {
12329                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
12330         }
12331         return ret;
12332 }
12333 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12334         LDKOutPoint ret = owner->a;
12335         ret.is_owned = false;
12336         return ret;
12337 }
12338 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
12339         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12340         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
12341         uint64_t ret_ref = 0;
12342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12344         return ret_ref;
12345 }
12346
12347 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12348         return CVec_MonitorUpdateIdZ_clone(&owner->b);
12349 }
12350 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
12351         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12352         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
12353         uint64_tArray ret_arr = NULL;
12354         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12355         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12356         for (size_t r = 0; r < ret_var.datalen; r++) {
12357                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
12358                 uint64_t ret_conv_17_ref = 0;
12359                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
12360                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
12361                 ret_arr_ptr[r] = ret_conv_17_ref;
12362         }
12363         
12364         FREE(ret_var.data);
12365         return ret_arr;
12366 }
12367
12368 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
12369         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
12370         for (size_t i = 0; i < ret.datalen; i++) {
12371                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
12372         }
12373         return ret;
12374 }
12375 typedef struct LDKKVStore_JCalls {
12376         atomic_size_t refcnt;
12377         uint32_t instance_ptr;
12378 } LDKKVStore_JCalls;
12379 static void LDKKVStore_JCalls_free(void* this_arg) {
12380         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12381         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12382                 FREE(j_calls);
12383         }
12384 }
12385 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
12386         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12387         LDKStr primary_namespace_str = primary_namespace;
12388         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12389         Str_free(primary_namespace_str);
12390         LDKStr secondary_namespace_str = secondary_namespace;
12391         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12392         Str_free(secondary_namespace_str);
12393         LDKStr key_str = key;
12394         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
12395         Str_free(key_str);
12396         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
12397         void* ret_ptr = untag_ptr(ret);
12398         CHECK_ACCESS(ret_ptr);
12399         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
12400         FREE(untag_ptr(ret));
12401         return ret_conv;
12402 }
12403 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
12404         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12405         LDKStr primary_namespace_str = primary_namespace;
12406         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12407         Str_free(primary_namespace_str);
12408         LDKStr secondary_namespace_str = secondary_namespace;
12409         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12410         Str_free(secondary_namespace_str);
12411         LDKStr key_str = key;
12412         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
12413         Str_free(key_str);
12414         LDKu8slice buf_var = buf;
12415         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
12416         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
12417         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, primary_namespace_conv, secondary_namespace_conv, key_conv, (uint32_t)buf_arr, 0, 0);
12418         void* ret_ptr = untag_ptr(ret);
12419         CHECK_ACCESS(ret_ptr);
12420         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12421         FREE(untag_ptr(ret));
12422         return ret_conv;
12423 }
12424 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
12425         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12426         LDKStr primary_namespace_str = primary_namespace;
12427         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12428         Str_free(primary_namespace_str);
12429         LDKStr secondary_namespace_str = secondary_namespace;
12430         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12431         Str_free(secondary_namespace_str);
12432         LDKStr key_str = key;
12433         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
12434         Str_free(key_str);
12435         jboolean lazy_conv = lazy;
12436         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
12437         void* ret_ptr = untag_ptr(ret);
12438         CHECK_ACCESS(ret_ptr);
12439         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12440         FREE(untag_ptr(ret));
12441         return ret_conv;
12442 }
12443 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
12444         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12445         LDKStr primary_namespace_str = primary_namespace;
12446         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12447         Str_free(primary_namespace_str);
12448         LDKStr secondary_namespace_str = secondary_namespace;
12449         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12450         Str_free(secondary_namespace_str);
12451         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
12452         void* ret_ptr = untag_ptr(ret);
12453         CHECK_ACCESS(ret_ptr);
12454         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
12455         FREE(untag_ptr(ret));
12456         return ret_conv;
12457 }
12458 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
12459         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
12460         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12461 }
12462 static inline LDKKVStore LDKKVStore_init (JSValue o) {
12463         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
12464         atomic_init(&calls->refcnt, 1);
12465         calls->instance_ptr = o;
12466
12467         LDKKVStore ret = {
12468                 .this_arg = (void*) calls,
12469                 .read = read_LDKKVStore_jcall,
12470                 .write = write_LDKKVStore_jcall,
12471                 .remove = remove_LDKKVStore_jcall,
12472                 .list = list_LDKKVStore_jcall,
12473                 .free = LDKKVStore_JCalls_free,
12474         };
12475         return ret;
12476 }
12477 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
12478         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
12479         *res_ptr = LDKKVStore_init(o);
12480         return tag_ptr(res_ptr, true);
12481 }
12482 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
12483         void* this_arg_ptr = untag_ptr(this_arg);
12484         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12485         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12486         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12487         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12488         LDKStr key_conv = str_ref_to_owned_c(key);
12489         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
12490         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
12491         return tag_ptr(ret_conv, true);
12492 }
12493
12494 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) {
12495         void* this_arg_ptr = untag_ptr(this_arg);
12496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12497         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12498         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12499         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12500         LDKStr key_conv = str_ref_to_owned_c(key);
12501         LDKu8slice buf_ref;
12502         buf_ref.datalen = buf->arr_len;
12503         buf_ref.data = buf->elems;
12504         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12505         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
12506         FREE(buf);
12507         return tag_ptr(ret_conv, true);
12508 }
12509
12510 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) {
12511         void* this_arg_ptr = untag_ptr(this_arg);
12512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12513         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12514         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12515         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12516         LDKStr key_conv = str_ref_to_owned_c(key);
12517         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12518         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
12519         return tag_ptr(ret_conv, true);
12520 }
12521
12522 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
12523         void* this_arg_ptr = untag_ptr(this_arg);
12524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12525         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12526         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12527         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12528         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
12529         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
12530         return tag_ptr(ret_conv, true);
12531 }
12532
12533 uint32_t __attribute__((export_name("TS_LDKCandidateRouteHop_ty_from_ptr"))) TS_LDKCandidateRouteHop_ty_from_ptr(uint64_t ptr) {
12534         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12535         switch(obj->tag) {
12536                 case LDKCandidateRouteHop_FirstHop: return 0;
12537                 case LDKCandidateRouteHop_PublicHop: return 1;
12538                 case LDKCandidateRouteHop_PrivateHop: return 2;
12539                 case LDKCandidateRouteHop_Blinded: return 3;
12540                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
12541                 default: abort();
12542         }
12543 }
12544 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_FirstHop_get_first_hop"))) TS_LDKCandidateRouteHop_FirstHop_get_first_hop(uint64_t ptr) {
12545         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12546         assert(obj->tag == LDKCandidateRouteHop_FirstHop);
12547         LDKFirstHopCandidate first_hop_var = obj->first_hop;
12548                         uint64_t first_hop_ref = 0;
12549                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
12550                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
12551         return first_hop_ref;
12552 }
12553 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PublicHop_get_public_hop"))) TS_LDKCandidateRouteHop_PublicHop_get_public_hop(uint64_t ptr) {
12554         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12555         assert(obj->tag == LDKCandidateRouteHop_PublicHop);
12556         LDKPublicHopCandidate public_hop_var = obj->public_hop;
12557                         uint64_t public_hop_ref = 0;
12558                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
12559                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
12560         return public_hop_ref;
12561 }
12562 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PrivateHop_get_private_hop"))) TS_LDKCandidateRouteHop_PrivateHop_get_private_hop(uint64_t ptr) {
12563         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12564         assert(obj->tag == LDKCandidateRouteHop_PrivateHop);
12565         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
12566                         uint64_t private_hop_ref = 0;
12567                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
12568                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
12569         return private_hop_ref;
12570 }
12571 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_Blinded_get_blinded"))) TS_LDKCandidateRouteHop_Blinded_get_blinded(uint64_t ptr) {
12572         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12573         assert(obj->tag == LDKCandidateRouteHop_Blinded);
12574         LDKBlindedPathCandidate blinded_var = obj->blinded;
12575                         uint64_t blinded_ref = 0;
12576                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
12577                         blinded_ref = tag_ptr(blinded_var.inner, false);
12578         return blinded_ref;
12579 }
12580 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded"))) TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(uint64_t ptr) {
12581         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12582         assert(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
12583         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
12584                         uint64_t one_hop_blinded_ref = 0;
12585                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
12586                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
12587         return one_hop_blinded_ref;
12588 }
12589 typedef struct LDKScoreLookUp_JCalls {
12590         atomic_size_t refcnt;
12591         uint32_t instance_ptr;
12592 } LDKScoreLookUp_JCalls;
12593 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
12594         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
12595         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12596                 FREE(j_calls);
12597         }
12598 }
12599 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
12600         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
12601         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
12602         *ret_candidate = CandidateRouteHop_clone(candidate);
12603         uint64_t ref_candidate = tag_ptr(ret_candidate, true);
12604         LDKChannelUsage usage_var = usage;
12605         uint64_t usage_ref = 0;
12606         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
12607         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
12608         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
12609         uint64_t score_params_ref = 0;
12610         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
12611         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
12612         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
12613         return js_invoke_function_bbbuuu(j_calls->instance_ptr, 53, ref_candidate, usage_ref, score_params_ref, 0, 0, 0);
12614 }
12615 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
12616         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
12617         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12618 }
12619 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
12620         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
12621         atomic_init(&calls->refcnt, 1);
12622         calls->instance_ptr = o;
12623
12624         LDKScoreLookUp ret = {
12625                 .this_arg = (void*) calls,
12626                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
12627                 .free = LDKScoreLookUp_JCalls_free,
12628         };
12629         return ret;
12630 }
12631 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
12632         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
12633         *res_ptr = LDKScoreLookUp_init(o);
12634         return tag_ptr(res_ptr, true);
12635 }
12636 int64_t  __attribute__((export_name("TS_ScoreLookUp_channel_penalty_msat"))) TS_ScoreLookUp_channel_penalty_msat(uint64_t this_arg, uint64_t candidate, uint64_t usage, uint64_t score_params) {
12637         void* this_arg_ptr = untag_ptr(this_arg);
12638         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12639         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
12640         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
12641         LDKChannelUsage usage_conv;
12642         usage_conv.inner = untag_ptr(usage);
12643         usage_conv.is_owned = ptr_is_owned(usage);
12644         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
12645         usage_conv = ChannelUsage_clone(&usage_conv);
12646         LDKProbabilisticScoringFeeParameters score_params_conv;
12647         score_params_conv.inner = untag_ptr(score_params);
12648         score_params_conv.is_owned = ptr_is_owned(score_params);
12649         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
12650         score_params_conv.is_owned = false;
12651         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
12652         return ret_conv;
12653 }
12654
12655 typedef struct LDKScoreUpdate_JCalls {
12656         atomic_size_t refcnt;
12657         uint32_t instance_ptr;
12658 } LDKScoreUpdate_JCalls;
12659 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
12660         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12661         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12662                 FREE(j_calls);
12663         }
12664 }
12665 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
12666         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12667         LDKPath path_var = *path;
12668         uint64_t path_ref = 0;
12669         path_var = Path_clone(&path_var);
12670         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12671         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12672         int64_t short_channel_id_conv = short_channel_id;
12673         int64_t duration_since_epoch_conv = duration_since_epoch;
12674         js_invoke_function_bbbuuu(j_calls->instance_ptr, 54, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
12675 }
12676 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
12677         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12678         LDKPath path_var = *path;
12679         uint64_t path_ref = 0;
12680         path_var = Path_clone(&path_var);
12681         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12682         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12683         int64_t duration_since_epoch_conv = duration_since_epoch;
12684         js_invoke_function_bbuuuu(j_calls->instance_ptr, 55, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
12685 }
12686 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
12687         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12688         LDKPath path_var = *path;
12689         uint64_t path_ref = 0;
12690         path_var = Path_clone(&path_var);
12691         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12692         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12693         int64_t short_channel_id_conv = short_channel_id;
12694         int64_t duration_since_epoch_conv = duration_since_epoch;
12695         js_invoke_function_bbbuuu(j_calls->instance_ptr, 56, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
12696 }
12697 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
12698         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12699         LDKPath path_var = *path;
12700         uint64_t path_ref = 0;
12701         path_var = Path_clone(&path_var);
12702         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12703         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12704         int64_t duration_since_epoch_conv = duration_since_epoch;
12705         js_invoke_function_bbuuuu(j_calls->instance_ptr, 57, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
12706 }
12707 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
12708         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12709         int64_t duration_since_epoch_conv = duration_since_epoch;
12710         js_invoke_function_buuuuu(j_calls->instance_ptr, 58, duration_since_epoch_conv, 0, 0, 0, 0, 0);
12711 }
12712 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
12713         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
12714         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12715 }
12716 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
12717         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
12718         atomic_init(&calls->refcnt, 1);
12719         calls->instance_ptr = o;
12720
12721         LDKScoreUpdate ret = {
12722                 .this_arg = (void*) calls,
12723                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
12724                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
12725                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
12726                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
12727                 .time_passed = time_passed_LDKScoreUpdate_jcall,
12728                 .free = LDKScoreUpdate_JCalls_free,
12729         };
12730         return ret;
12731 }
12732 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
12733         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
12734         *res_ptr = LDKScoreUpdate_init(o);
12735         return tag_ptr(res_ptr, true);
12736 }
12737 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, int64_t duration_since_epoch) {
12738         void* this_arg_ptr = untag_ptr(this_arg);
12739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12740         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12741         LDKPath path_conv;
12742         path_conv.inner = untag_ptr(path);
12743         path_conv.is_owned = ptr_is_owned(path);
12744         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12745         path_conv.is_owned = false;
12746         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
12747 }
12748
12749 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_successful"))) TS_ScoreUpdate_payment_path_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
12750         void* this_arg_ptr = untag_ptr(this_arg);
12751         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12752         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12753         LDKPath path_conv;
12754         path_conv.inner = untag_ptr(path);
12755         path_conv.is_owned = ptr_is_owned(path);
12756         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12757         path_conv.is_owned = false;
12758         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
12759 }
12760
12761 void  __attribute__((export_name("TS_ScoreUpdate_probe_failed"))) TS_ScoreUpdate_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
12762         void* this_arg_ptr = untag_ptr(this_arg);
12763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12764         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12765         LDKPath path_conv;
12766         path_conv.inner = untag_ptr(path);
12767         path_conv.is_owned = ptr_is_owned(path);
12768         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12769         path_conv.is_owned = false;
12770         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
12771 }
12772
12773 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
12774         void* this_arg_ptr = untag_ptr(this_arg);
12775         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12776         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12777         LDKPath path_conv;
12778         path_conv.inner = untag_ptr(path);
12779         path_conv.is_owned = ptr_is_owned(path);
12780         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12781         path_conv.is_owned = false;
12782         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
12783 }
12784
12785 void  __attribute__((export_name("TS_ScoreUpdate_time_passed"))) TS_ScoreUpdate_time_passed(uint64_t this_arg, int64_t duration_since_epoch) {
12786         void* this_arg_ptr = untag_ptr(this_arg);
12787         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12788         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12789         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
12790 }
12791
12792 typedef struct LDKLockableScore_JCalls {
12793         atomic_size_t refcnt;
12794         uint32_t instance_ptr;
12795 } LDKLockableScore_JCalls;
12796 static void LDKLockableScore_JCalls_free(void* this_arg) {
12797         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12798         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12799                 FREE(j_calls);
12800         }
12801 }
12802 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
12803         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12804         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, 0, 0, 0, 0, 0, 0);
12805         void* ret_ptr = untag_ptr(ret);
12806         CHECK_ACCESS(ret_ptr);
12807         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
12808         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
12809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12810                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
12811         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
12812         
12813         return ret_conv;
12814 }
12815 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
12816         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12817         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, 0, 0, 0, 0, 0, 0);
12818         void* ret_ptr = untag_ptr(ret);
12819         CHECK_ACCESS(ret_ptr);
12820         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
12821         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
12822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12823                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
12824         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
12825         
12826         return ret_conv;
12827 }
12828 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
12829         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
12830         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12831 }
12832 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
12833         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
12834         atomic_init(&calls->refcnt, 1);
12835         calls->instance_ptr = o;
12836
12837         LDKLockableScore ret = {
12838                 .this_arg = (void*) calls,
12839                 .read_lock = read_lock_LDKLockableScore_jcall,
12840                 .write_lock = write_lock_LDKLockableScore_jcall,
12841                 .free = LDKLockableScore_JCalls_free,
12842         };
12843         return ret;
12844 }
12845 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
12846         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
12847         *res_ptr = LDKLockableScore_init(o);
12848         return tag_ptr(res_ptr, true);
12849 }
12850 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
12851         void* this_arg_ptr = untag_ptr(this_arg);
12852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12853         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12854         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
12855         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
12856         return tag_ptr(ret_ret, true);
12857 }
12858
12859 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
12860         void* this_arg_ptr = untag_ptr(this_arg);
12861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12862         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12863         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
12864         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
12865         return tag_ptr(ret_ret, true);
12866 }
12867
12868 typedef struct LDKWriteableScore_JCalls {
12869         atomic_size_t refcnt;
12870         uint32_t instance_ptr;
12871         LDKLockableScore_JCalls* LockableScore;
12872 } LDKWriteableScore_JCalls;
12873 static void LDKWriteableScore_JCalls_free(void* this_arg) {
12874         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
12875         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12876                 FREE(j_calls);
12877         }
12878 }
12879 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
12880         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
12881         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
12882         LDKCVec_u8Z ret_ref;
12883         ret_ref.datalen = ret->arr_len;
12884         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
12885         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
12886         return ret_ref;
12887 }
12888 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
12889         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
12890         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12891         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
12892 }
12893 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
12894         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
12895         atomic_init(&calls->refcnt, 1);
12896         calls->instance_ptr = o;
12897
12898         LDKWriteableScore ret = {
12899                 .this_arg = (void*) calls,
12900                 .write = write_LDKWriteableScore_jcall,
12901                 .free = LDKWriteableScore_JCalls_free,
12902                 .LockableScore = LDKLockableScore_init(LockableScore),
12903         };
12904         calls->LockableScore = ret.LockableScore.this_arg;
12905         return ret;
12906 }
12907 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
12908         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
12909         *res_ptr = LDKWriteableScore_init(o, LockableScore);
12910         return tag_ptr(res_ptr, true);
12911 }
12912 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
12913         void* this_arg_ptr = untag_ptr(this_arg);
12914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12915         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
12916         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
12917         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
12918         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
12919         CVec_u8Z_free(ret_var);
12920         return ret_arr;
12921 }
12922
12923 typedef struct LDKPersister_JCalls {
12924         atomic_size_t refcnt;
12925         uint32_t instance_ptr;
12926 } LDKPersister_JCalls;
12927 static void LDKPersister_JCalls_free(void* this_arg) {
12928         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12929         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12930                 FREE(j_calls);
12931         }
12932 }
12933 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
12934         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12935         LDKChannelManager channel_manager_var = *channel_manager;
12936         uint64_t channel_manager_ref = 0;
12937         // WARNING: we may need a move here but no clone is available for LDKChannelManager
12938         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
12939         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
12940         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 62, channel_manager_ref, 0, 0, 0, 0, 0);
12941         void* ret_ptr = untag_ptr(ret);
12942         CHECK_ACCESS(ret_ptr);
12943         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12944         FREE(untag_ptr(ret));
12945         return ret_conv;
12946 }
12947 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
12948         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12949         LDKNetworkGraph network_graph_var = *network_graph;
12950         uint64_t network_graph_ref = 0;
12951         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
12952         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
12953         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
12954         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 63, network_graph_ref, 0, 0, 0, 0, 0);
12955         void* ret_ptr = untag_ptr(ret);
12956         CHECK_ACCESS(ret_ptr);
12957         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12958         FREE(untag_ptr(ret));
12959         return ret_conv;
12960 }
12961 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
12962         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12963         // WARNING: This object doesn't live past this scope, needs clone!
12964         uint64_t ret_scorer = tag_ptr(scorer, false);
12965         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 64, ret_scorer, 0, 0, 0, 0, 0);
12966         void* ret_ptr = untag_ptr(ret);
12967         CHECK_ACCESS(ret_ptr);
12968         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12969         FREE(untag_ptr(ret));
12970         return ret_conv;
12971 }
12972 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
12973         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
12974         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12975 }
12976 static inline LDKPersister LDKPersister_init (JSValue o) {
12977         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
12978         atomic_init(&calls->refcnt, 1);
12979         calls->instance_ptr = o;
12980
12981         LDKPersister ret = {
12982                 .this_arg = (void*) calls,
12983                 .persist_manager = persist_manager_LDKPersister_jcall,
12984                 .persist_graph = persist_graph_LDKPersister_jcall,
12985                 .persist_scorer = persist_scorer_LDKPersister_jcall,
12986                 .free = LDKPersister_JCalls_free,
12987         };
12988         return ret;
12989 }
12990 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
12991         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
12992         *res_ptr = LDKPersister_init(o);
12993         return tag_ptr(res_ptr, true);
12994 }
12995 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
12996         void* this_arg_ptr = untag_ptr(this_arg);
12997         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12998         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12999         LDKChannelManager channel_manager_conv;
13000         channel_manager_conv.inner = untag_ptr(channel_manager);
13001         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
13002         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13003         channel_manager_conv.is_owned = false;
13004         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13005         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13006         return tag_ptr(ret_conv, true);
13007 }
13008
13009 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
13010         void* this_arg_ptr = untag_ptr(this_arg);
13011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13012         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13013         LDKNetworkGraph network_graph_conv;
13014         network_graph_conv.inner = untag_ptr(network_graph);
13015         network_graph_conv.is_owned = ptr_is_owned(network_graph);
13016         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
13017         network_graph_conv.is_owned = false;
13018         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13019         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
13020         return tag_ptr(ret_conv, true);
13021 }
13022
13023 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
13024         void* this_arg_ptr = untag_ptr(this_arg);
13025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13026         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13027         void* scorer_ptr = untag_ptr(scorer);
13028         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13029         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
13030         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13031         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
13032         return tag_ptr(ret_conv, true);
13033 }
13034
13035 typedef struct LDKPersist_JCalls {
13036         atomic_size_t refcnt;
13037         uint32_t instance_ptr;
13038 } LDKPersist_JCalls;
13039 static void LDKPersist_JCalls_free(void* this_arg) {
13040         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13041         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13042                 FREE(j_calls);
13043         }
13044 }
13045 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13046         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13047         LDKOutPoint channel_id_var = channel_id;
13048         uint64_t channel_id_ref = 0;
13049         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13050         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13051         LDKChannelMonitor data_var = *data;
13052         uint64_t data_ref = 0;
13053         data_var = ChannelMonitor_clone(&data_var);
13054         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13055         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13056         LDKMonitorUpdateId update_id_var = update_id;
13057         uint64_t update_id_ref = 0;
13058         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13059         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13060         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
13061         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
13062         return ret_conv;
13063 }
13064 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13065         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13066         LDKOutPoint channel_id_var = channel_id;
13067         uint64_t channel_id_ref = 0;
13068         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13069         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13070         LDKChannelMonitorUpdate update_var = update;
13071         uint64_t update_ref = 0;
13072         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
13073         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
13074         LDKChannelMonitor data_var = *data;
13075         uint64_t data_ref = 0;
13076         data_var = ChannelMonitor_clone(&data_var);
13077         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13078         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13079         LDKMonitorUpdateId update_id_var = update_id;
13080         uint64_t update_id_ref = 0;
13081         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13082         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13083         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
13084         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
13085         return ret_conv;
13086 }
13087 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
13088         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
13089         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13090 }
13091 static inline LDKPersist LDKPersist_init (JSValue o) {
13092         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
13093         atomic_init(&calls->refcnt, 1);
13094         calls->instance_ptr = o;
13095
13096         LDKPersist ret = {
13097                 .this_arg = (void*) calls,
13098                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
13099                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
13100                 .free = LDKPersist_JCalls_free,
13101         };
13102         return ret;
13103 }
13104 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
13105         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
13106         *res_ptr = LDKPersist_init(o);
13107         return tag_ptr(res_ptr, true);
13108 }
13109 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) {
13110         void* this_arg_ptr = untag_ptr(this_arg);
13111         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13112         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13113         LDKOutPoint channel_id_conv;
13114         channel_id_conv.inner = untag_ptr(channel_id);
13115         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13116         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13117         channel_id_conv = OutPoint_clone(&channel_id_conv);
13118         LDKChannelMonitor data_conv;
13119         data_conv.inner = untag_ptr(data);
13120         data_conv.is_owned = ptr_is_owned(data);
13121         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13122         data_conv.is_owned = false;
13123         LDKMonitorUpdateId update_id_conv;
13124         update_id_conv.inner = untag_ptr(update_id);
13125         update_id_conv.is_owned = ptr_is_owned(update_id);
13126         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13127         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13128         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));
13129         return ret_conv;
13130 }
13131
13132 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) {
13133         void* this_arg_ptr = untag_ptr(this_arg);
13134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13135         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13136         LDKOutPoint channel_id_conv;
13137         channel_id_conv.inner = untag_ptr(channel_id);
13138         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13139         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13140         channel_id_conv = OutPoint_clone(&channel_id_conv);
13141         LDKChannelMonitorUpdate update_conv;
13142         update_conv.inner = untag_ptr(update);
13143         update_conv.is_owned = ptr_is_owned(update);
13144         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
13145         update_conv = ChannelMonitorUpdate_clone(&update_conv);
13146         LDKChannelMonitor data_conv;
13147         data_conv.inner = untag_ptr(data);
13148         data_conv.is_owned = ptr_is_owned(data);
13149         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13150         data_conv.is_owned = false;
13151         LDKMonitorUpdateId update_id_conv;
13152         update_id_conv.inner = untag_ptr(update_id);
13153         update_id_conv.is_owned = ptr_is_owned(update_id);
13154         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13155         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13156         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));
13157         return ret_conv;
13158 }
13159
13160 typedef struct LDKFutureCallback_JCalls {
13161         atomic_size_t refcnt;
13162         uint32_t instance_ptr;
13163 } LDKFutureCallback_JCalls;
13164 static void LDKFutureCallback_JCalls_free(void* this_arg) {
13165         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13166         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13167                 FREE(j_calls);
13168         }
13169 }
13170 void call_LDKFutureCallback_jcall(const void* this_arg) {
13171         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13172         js_invoke_function_uuuuuu(j_calls->instance_ptr, 67, 0, 0, 0, 0, 0, 0);
13173 }
13174 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
13175         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
13176         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13177 }
13178 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
13179         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
13180         atomic_init(&calls->refcnt, 1);
13181         calls->instance_ptr = o;
13182
13183         LDKFutureCallback ret = {
13184                 .this_arg = (void*) calls,
13185                 .call = call_LDKFutureCallback_jcall,
13186                 .free = LDKFutureCallback_JCalls_free,
13187         };
13188         return ret;
13189 }
13190 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
13191         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
13192         *res_ptr = LDKFutureCallback_init(o);
13193         return tag_ptr(res_ptr, true);
13194 }
13195 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
13196         void* this_arg_ptr = untag_ptr(this_arg);
13197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13198         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
13199         (this_arg_conv->call)(this_arg_conv->this_arg);
13200 }
13201
13202 typedef struct LDKListen_JCalls {
13203         atomic_size_t refcnt;
13204         uint32_t instance_ptr;
13205 } LDKListen_JCalls;
13206 static void LDKListen_JCalls_free(void* this_arg) {
13207         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13208         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13209                 FREE(j_calls);
13210         }
13211 }
13212 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13213         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13214         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13215         memcpy(header_arr->elems, *header, 80);
13216         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13217         uint64_tArray txdata_arr = NULL;
13218         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
13219         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
13220         for (size_t c = 0; c < txdata_var.datalen; c++) {
13221                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13222                 *txdata_conv_28_conv = txdata_var.data[c];
13223                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13224         }
13225         
13226         FREE(txdata_var.data);
13227         int32_t height_conv = height;
13228         js_invoke_function_uuuuuu(j_calls->instance_ptr, 68, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
13229 }
13230 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
13231         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13232         LDKu8slice block_var = block;
13233         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
13234         memcpy(block_arr->elems, block_var.data, block_var.datalen);
13235         int32_t height_conv = height;
13236         js_invoke_function_uuuuuu(j_calls->instance_ptr, 69, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
13237 }
13238 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13239         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13240         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13241         memcpy(header_arr->elems, *header, 80);
13242         int32_t height_conv = height;
13243         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
13244 }
13245 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
13246         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
13247         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13248 }
13249 static inline LDKListen LDKListen_init (JSValue o) {
13250         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
13251         atomic_init(&calls->refcnt, 1);
13252         calls->instance_ptr = o;
13253
13254         LDKListen ret = {
13255                 .this_arg = (void*) calls,
13256                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
13257                 .block_connected = block_connected_LDKListen_jcall,
13258                 .block_disconnected = block_disconnected_LDKListen_jcall,
13259                 .free = LDKListen_JCalls_free,
13260         };
13261         return ret;
13262 }
13263 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
13264         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
13265         *res_ptr = LDKListen_init(o);
13266         return tag_ptr(res_ptr, true);
13267 }
13268 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) {
13269         void* this_arg_ptr = untag_ptr(this_arg);
13270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13271         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13272         uint8_t header_arr[80];
13273         CHECK(header->arr_len == 80);
13274         memcpy(header_arr, header->elems, 80); FREE(header);
13275         uint8_t (*header_ref)[80] = &header_arr;
13276         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13277         txdata_constr.datalen = txdata->arr_len;
13278         if (txdata_constr.datalen > 0)
13279                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13280         else
13281                 txdata_constr.data = NULL;
13282         uint64_t* txdata_vals = txdata->elems;
13283         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13284                 uint64_t txdata_conv_28 = txdata_vals[c];
13285                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13286                 CHECK_ACCESS(txdata_conv_28_ptr);
13287                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13288                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13289                 txdata_constr.data[c] = txdata_conv_28_conv;
13290         }
13291         FREE(txdata);
13292         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13293 }
13294
13295 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
13296         void* this_arg_ptr = untag_ptr(this_arg);
13297         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13298         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13299         LDKu8slice block_ref;
13300         block_ref.datalen = block->arr_len;
13301         block_ref.data = block->elems;
13302         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
13303         FREE(block);
13304 }
13305
13306 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
13307         void* this_arg_ptr = untag_ptr(this_arg);
13308         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13309         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13310         uint8_t header_arr[80];
13311         CHECK(header->arr_len == 80);
13312         memcpy(header_arr, header->elems, 80); FREE(header);
13313         uint8_t (*header_ref)[80] = &header_arr;
13314         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
13315 }
13316
13317 typedef struct LDKConfirm_JCalls {
13318         atomic_size_t refcnt;
13319         uint32_t instance_ptr;
13320 } LDKConfirm_JCalls;
13321 static void LDKConfirm_JCalls_free(void* this_arg) {
13322         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13323         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13324                 FREE(j_calls);
13325         }
13326 }
13327 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13328         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13329         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13330         memcpy(header_arr->elems, *header, 80);
13331         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13332         uint64_tArray txdata_arr = NULL;
13333         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
13334         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
13335         for (size_t c = 0; c < txdata_var.datalen; c++) {
13336                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13337                 *txdata_conv_28_conv = txdata_var.data[c];
13338                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13339         }
13340         
13341         FREE(txdata_var.data);
13342         int32_t height_conv = height;
13343         js_invoke_function_uuuuuu(j_calls->instance_ptr, 71, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
13344 }
13345 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
13346         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13347         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13348         memcpy(txid_arr->elems, *txid, 32);
13349         js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
13350 }
13351 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13352         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13353         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13354         memcpy(header_arr->elems, *header, 80);
13355         int32_t height_conv = height;
13356         js_invoke_function_uuuuuu(j_calls->instance_ptr, 73, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
13357 }
13358 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
13359         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13360         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 74, 0, 0, 0, 0, 0, 0);
13361         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
13362         ret_constr.datalen = ret->arr_len;
13363         if (ret_constr.datalen > 0)
13364                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
13365         else
13366                 ret_constr.data = NULL;
13367         uint64_t* ret_vals = ret->elems;
13368         for (size_t c = 0; c < ret_constr.datalen; c++) {
13369                 uint64_t ret_conv_54 = ret_vals[c];
13370                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
13371                 CHECK_ACCESS(ret_conv_54_ptr);
13372                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
13373                 FREE(untag_ptr(ret_conv_54));
13374                 ret_constr.data[c] = ret_conv_54_conv;
13375         }
13376         FREE(ret);
13377         return ret_constr;
13378 }
13379 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
13380         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
13381         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13382 }
13383 static inline LDKConfirm LDKConfirm_init (JSValue o) {
13384         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
13385         atomic_init(&calls->refcnt, 1);
13386         calls->instance_ptr = o;
13387
13388         LDKConfirm ret = {
13389                 .this_arg = (void*) calls,
13390                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
13391                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
13392                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
13393                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
13394                 .free = LDKConfirm_JCalls_free,
13395         };
13396         return ret;
13397 }
13398 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
13399         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13400         *res_ptr = LDKConfirm_init(o);
13401         return tag_ptr(res_ptr, true);
13402 }
13403 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) {
13404         void* this_arg_ptr = untag_ptr(this_arg);
13405         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13406         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13407         uint8_t header_arr[80];
13408         CHECK(header->arr_len == 80);
13409         memcpy(header_arr, header->elems, 80); FREE(header);
13410         uint8_t (*header_ref)[80] = &header_arr;
13411         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13412         txdata_constr.datalen = txdata->arr_len;
13413         if (txdata_constr.datalen > 0)
13414                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13415         else
13416                 txdata_constr.data = NULL;
13417         uint64_t* txdata_vals = txdata->elems;
13418         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13419                 uint64_t txdata_conv_28 = txdata_vals[c];
13420                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13421                 CHECK_ACCESS(txdata_conv_28_ptr);
13422                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13423                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13424                 txdata_constr.data[c] = txdata_conv_28_conv;
13425         }
13426         FREE(txdata);
13427         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13428 }
13429
13430 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
13431         void* this_arg_ptr = untag_ptr(this_arg);
13432         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13433         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13434         uint8_t txid_arr[32];
13435         CHECK(txid->arr_len == 32);
13436         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13437         uint8_t (*txid_ref)[32] = &txid_arr;
13438         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
13439 }
13440
13441 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
13442         void* this_arg_ptr = untag_ptr(this_arg);
13443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13444         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13445         uint8_t header_arr[80];
13446         CHECK(header->arr_len == 80);
13447         memcpy(header_arr, header->elems, 80); FREE(header);
13448         uint8_t (*header_ref)[80] = &header_arr;
13449         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
13450 }
13451
13452 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
13453         void* this_arg_ptr = untag_ptr(this_arg);
13454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13455         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13456         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
13457         uint64_tArray ret_arr = NULL;
13458         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13459         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13460         for (size_t c = 0; c < ret_var.datalen; c++) {
13461                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
13462                 *ret_conv_54_conv = ret_var.data[c];
13463                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
13464         }
13465         
13466         FREE(ret_var.data);
13467         return ret_arr;
13468 }
13469
13470 typedef struct LDKEventHandler_JCalls {
13471         atomic_size_t refcnt;
13472         uint32_t instance_ptr;
13473 } LDKEventHandler_JCalls;
13474 static void LDKEventHandler_JCalls_free(void* this_arg) {
13475         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13476         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13477                 FREE(j_calls);
13478         }
13479 }
13480 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
13481         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13482         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13483         *event_copy = event;
13484         uint64_t event_ref = tag_ptr(event_copy, true);
13485         js_invoke_function_buuuuu(j_calls->instance_ptr, 75, event_ref, 0, 0, 0, 0, 0);
13486 }
13487 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
13488         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
13489         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13490 }
13491 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
13492         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
13493         atomic_init(&calls->refcnt, 1);
13494         calls->instance_ptr = o;
13495
13496         LDKEventHandler ret = {
13497                 .this_arg = (void*) calls,
13498                 .handle_event = handle_event_LDKEventHandler_jcall,
13499                 .free = LDKEventHandler_JCalls_free,
13500         };
13501         return ret;
13502 }
13503 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
13504         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13505         *res_ptr = LDKEventHandler_init(o);
13506         return tag_ptr(res_ptr, true);
13507 }
13508 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
13509         void* this_arg_ptr = untag_ptr(this_arg);
13510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13511         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
13512         void* event_ptr = untag_ptr(event);
13513         CHECK_ACCESS(event_ptr);
13514         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
13515         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
13516         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
13517 }
13518
13519 typedef struct LDKEventsProvider_JCalls {
13520         atomic_size_t refcnt;
13521         uint32_t instance_ptr;
13522 } LDKEventsProvider_JCalls;
13523 static void LDKEventsProvider_JCalls_free(void* this_arg) {
13524         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13525         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13526                 FREE(j_calls);
13527         }
13528 }
13529 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
13530         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13531         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13532         *handler_ret = handler;
13533         js_invoke_function_buuuuu(j_calls->instance_ptr, 76, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
13534 }
13535 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
13536         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
13537         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13538 }
13539 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
13540         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
13541         atomic_init(&calls->refcnt, 1);
13542         calls->instance_ptr = o;
13543
13544         LDKEventsProvider ret = {
13545                 .this_arg = (void*) calls,
13546                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
13547                 .free = LDKEventsProvider_JCalls_free,
13548         };
13549         return ret;
13550 }
13551 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
13552         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13553         *res_ptr = LDKEventsProvider_init(o);
13554         return tag_ptr(res_ptr, true);
13555 }
13556 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
13557         void* this_arg_ptr = untag_ptr(this_arg);
13558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13559         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
13560         void* handler_ptr = untag_ptr(handler);
13561         CHECK_ACCESS(handler_ptr);
13562         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
13563         if (handler_conv.free == LDKEventHandler_JCalls_free) {
13564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13565                 LDKEventHandler_JCalls_cloned(&handler_conv);
13566         }
13567         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
13568 }
13569
13570 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
13571         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13572         switch(obj->tag) {
13573                 case LDKFailureCode_TemporaryNodeFailure: return 0;
13574                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
13575                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
13576                 case LDKFailureCode_InvalidOnionPayload: return 3;
13577                 default: abort();
13578         }
13579 }
13580 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
13581         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13582         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
13583         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
13584         return invalid_onion_payload_ref;
13585 }
13586 typedef struct LDKMessageSendEventsProvider_JCalls {
13587         atomic_size_t refcnt;
13588         uint32_t instance_ptr;
13589 } LDKMessageSendEventsProvider_JCalls;
13590 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
13591         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13592         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13593                 FREE(j_calls);
13594         }
13595 }
13596 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
13597         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13598         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 77, 0, 0, 0, 0, 0, 0);
13599         LDKCVec_MessageSendEventZ ret_constr;
13600         ret_constr.datalen = ret->arr_len;
13601         if (ret_constr.datalen > 0)
13602                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13603         else
13604                 ret_constr.data = NULL;
13605         uint64_t* ret_vals = ret->elems;
13606         for (size_t s = 0; s < ret_constr.datalen; s++) {
13607                 uint64_t ret_conv_18 = ret_vals[s];
13608                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
13609                 CHECK_ACCESS(ret_conv_18_ptr);
13610                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
13611                 FREE(untag_ptr(ret_conv_18));
13612                 ret_constr.data[s] = ret_conv_18_conv;
13613         }
13614         FREE(ret);
13615         return ret_constr;
13616 }
13617 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
13618         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
13619         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13620 }
13621 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
13622         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
13623         atomic_init(&calls->refcnt, 1);
13624         calls->instance_ptr = o;
13625
13626         LDKMessageSendEventsProvider ret = {
13627                 .this_arg = (void*) calls,
13628                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
13629                 .free = LDKMessageSendEventsProvider_JCalls_free,
13630         };
13631         return ret;
13632 }
13633 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
13634         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
13635         *res_ptr = LDKMessageSendEventsProvider_init(o);
13636         return tag_ptr(res_ptr, true);
13637 }
13638 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) {
13639         void* this_arg_ptr = untag_ptr(this_arg);
13640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13641         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
13642         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
13643         uint64_tArray ret_arr = NULL;
13644         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13645         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13646         for (size_t s = 0; s < ret_var.datalen; s++) {
13647                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13648                 *ret_conv_18_copy = ret_var.data[s];
13649                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
13650                 ret_arr_ptr[s] = ret_conv_18_ref;
13651         }
13652         
13653         FREE(ret_var.data);
13654         return ret_arr;
13655 }
13656
13657 typedef struct LDKChannelMessageHandler_JCalls {
13658         atomic_size_t refcnt;
13659         uint32_t instance_ptr;
13660         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13661 } LDKChannelMessageHandler_JCalls;
13662 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
13663         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13664         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13665                 FREE(j_calls);
13666         }
13667 }
13668 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
13669         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13670         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13671         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13672         LDKOpenChannel msg_var = *msg;
13673         uint64_t msg_ref = 0;
13674         msg_var = OpenChannel_clone(&msg_var);
13675         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13676         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13677         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13678 }
13679 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
13680         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13681         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13682         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13683         LDKOpenChannelV2 msg_var = *msg;
13684         uint64_t msg_ref = 0;
13685         msg_var = OpenChannelV2_clone(&msg_var);
13686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13687         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13688         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13689 }
13690 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
13691         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13692         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13693         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13694         LDKAcceptChannel msg_var = *msg;
13695         uint64_t msg_ref = 0;
13696         msg_var = AcceptChannel_clone(&msg_var);
13697         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13698         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13699         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13700 }
13701 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
13702         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13703         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13704         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13705         LDKAcceptChannelV2 msg_var = *msg;
13706         uint64_t msg_ref = 0;
13707         msg_var = AcceptChannelV2_clone(&msg_var);
13708         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13709         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13710         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13711 }
13712 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
13713         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13714         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13715         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13716         LDKFundingCreated msg_var = *msg;
13717         uint64_t msg_ref = 0;
13718         msg_var = FundingCreated_clone(&msg_var);
13719         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13720         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13721         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13722 }
13723 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
13724         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13725         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13726         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13727         LDKFundingSigned msg_var = *msg;
13728         uint64_t msg_ref = 0;
13729         msg_var = FundingSigned_clone(&msg_var);
13730         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13731         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13732         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13733 }
13734 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
13735         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13736         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13737         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13738         LDKChannelReady msg_var = *msg;
13739         uint64_t msg_ref = 0;
13740         msg_var = ChannelReady_clone(&msg_var);
13741         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13742         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13743         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13744 }
13745 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
13746         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13747         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13748         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13749         LDKShutdown msg_var = *msg;
13750         uint64_t msg_ref = 0;
13751         msg_var = Shutdown_clone(&msg_var);
13752         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13753         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13754         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13755 }
13756 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
13757         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13758         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13759         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13760         LDKClosingSigned msg_var = *msg;
13761         uint64_t msg_ref = 0;
13762         msg_var = ClosingSigned_clone(&msg_var);
13763         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13764         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13765         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13766 }
13767 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
13768         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13769         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13770         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13771         LDKStfu msg_var = *msg;
13772         uint64_t msg_ref = 0;
13773         msg_var = Stfu_clone(&msg_var);
13774         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13775         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13776         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13777 }
13778 void handle_splice_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSplice * msg) {
13779         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13780         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13781         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13782         LDKSplice msg_var = *msg;
13783         uint64_t msg_ref = 0;
13784         msg_var = Splice_clone(&msg_var);
13785         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13786         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13787         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13788 }
13789 void handle_splice_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceAck * msg) {
13790         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13791         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13792         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13793         LDKSpliceAck msg_var = *msg;
13794         uint64_t msg_ref = 0;
13795         msg_var = SpliceAck_clone(&msg_var);
13796         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13797         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13798         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13799 }
13800 void handle_splice_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceLocked * msg) {
13801         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13802         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13803         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13804         LDKSpliceLocked msg_var = *msg;
13805         uint64_t msg_ref = 0;
13806         msg_var = SpliceLocked_clone(&msg_var);
13807         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13808         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13809         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13810 }
13811 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
13812         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13813         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13814         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13815         LDKTxAddInput msg_var = *msg;
13816         uint64_t msg_ref = 0;
13817         msg_var = TxAddInput_clone(&msg_var);
13818         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13819         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13820         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13821 }
13822 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
13823         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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         LDKTxAddOutput msg_var = *msg;
13827         uint64_t msg_ref = 0;
13828         msg_var = TxAddOutput_clone(&msg_var);
13829         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13830         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13831         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13832 }
13833 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
13834         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13835         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13836         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13837         LDKTxRemoveInput msg_var = *msg;
13838         uint64_t msg_ref = 0;
13839         msg_var = TxRemoveInput_clone(&msg_var);
13840         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13841         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13842         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13843 }
13844 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
13845         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13846         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13847         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13848         LDKTxRemoveOutput msg_var = *msg;
13849         uint64_t msg_ref = 0;
13850         msg_var = TxRemoveOutput_clone(&msg_var);
13851         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13852         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13853         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13854 }
13855 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
13856         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13857         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13858         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13859         LDKTxComplete msg_var = *msg;
13860         uint64_t msg_ref = 0;
13861         msg_var = TxComplete_clone(&msg_var);
13862         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13863         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13864         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13865 }
13866 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
13867         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13868         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13869         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13870         LDKTxSignatures msg_var = *msg;
13871         uint64_t msg_ref = 0;
13872         msg_var = TxSignatures_clone(&msg_var);
13873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13874         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13875         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13876 }
13877 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
13878         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13879         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13880         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13881         LDKTxInitRbf msg_var = *msg;
13882         uint64_t msg_ref = 0;
13883         msg_var = TxInitRbf_clone(&msg_var);
13884         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13885         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13886         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13887 }
13888 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
13889         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13890         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13891         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13892         LDKTxAckRbf msg_var = *msg;
13893         uint64_t msg_ref = 0;
13894         msg_var = TxAckRbf_clone(&msg_var);
13895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13896         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13897         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13898 }
13899 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
13900         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13901         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13902         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13903         LDKTxAbort msg_var = *msg;
13904         uint64_t msg_ref = 0;
13905         msg_var = TxAbort_clone(&msg_var);
13906         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13907         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13908         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13909 }
13910 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
13911         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13912         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13913         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13914         LDKUpdateAddHTLC msg_var = *msg;
13915         uint64_t msg_ref = 0;
13916         msg_var = UpdateAddHTLC_clone(&msg_var);
13917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13918         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13919         js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13920 }
13921 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
13922         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13923         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13924         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13925         LDKUpdateFulfillHTLC msg_var = *msg;
13926         uint64_t msg_ref = 0;
13927         msg_var = UpdateFulfillHTLC_clone(&msg_var);
13928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13929         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13930         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13931 }
13932 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
13933         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13934         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13935         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13936         LDKUpdateFailHTLC msg_var = *msg;
13937         uint64_t msg_ref = 0;
13938         msg_var = UpdateFailHTLC_clone(&msg_var);
13939         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13940         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13941         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13942 }
13943 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
13944         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13945         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13946         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13947         LDKUpdateFailMalformedHTLC msg_var = *msg;
13948         uint64_t msg_ref = 0;
13949         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
13950         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13951         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13952         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13953 }
13954 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
13955         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13956         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13957         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13958         LDKCommitmentSigned msg_var = *msg;
13959         uint64_t msg_ref = 0;
13960         msg_var = CommitmentSigned_clone(&msg_var);
13961         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13962         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13963         js_invoke_function_ubuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13964 }
13965 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
13966         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13967         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13968         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13969         LDKRevokeAndACK msg_var = *msg;
13970         uint64_t msg_ref = 0;
13971         msg_var = RevokeAndACK_clone(&msg_var);
13972         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13973         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13974         js_invoke_function_ubuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13975 }
13976 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
13977         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13978         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13979         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13980         LDKUpdateFee msg_var = *msg;
13981         uint64_t msg_ref = 0;
13982         msg_var = UpdateFee_clone(&msg_var);
13983         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13984         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13985         js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13986 }
13987 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
13988         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13989         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13990         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13991         LDKAnnouncementSignatures msg_var = *msg;
13992         uint64_t msg_ref = 0;
13993         msg_var = AnnouncementSignatures_clone(&msg_var);
13994         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13995         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13996         js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13997 }
13998 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13999         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14000         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14001         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14002         js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14003 }
14004 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
14005         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14006         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14007         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14008         LDKInit msg_var = *msg;
14009         uint64_t msg_ref = 0;
14010         msg_var = Init_clone(&msg_var);
14011         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14012         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14013         jboolean inbound_conv = inbound;
14014         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 109, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
14015         void* ret_ptr = untag_ptr(ret);
14016         CHECK_ACCESS(ret_ptr);
14017         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14018         FREE(untag_ptr(ret));
14019         return ret_conv;
14020 }
14021 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
14022         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14023         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14024         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14025         LDKChannelReestablish msg_var = *msg;
14026         uint64_t msg_ref = 0;
14027         msg_var = ChannelReestablish_clone(&msg_var);
14028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14029         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14030         js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14031 }
14032 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
14033         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14034         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14035         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14036         LDKChannelUpdate msg_var = *msg;
14037         uint64_t msg_ref = 0;
14038         msg_var = ChannelUpdate_clone(&msg_var);
14039         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14040         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14041         js_invoke_function_ubuuuu(j_calls->instance_ptr, 111, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14042 }
14043 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
14044         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14045         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14046         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14047         LDKErrorMessage msg_var = *msg;
14048         uint64_t msg_ref = 0;
14049         msg_var = ErrorMessage_clone(&msg_var);
14050         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14051         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14052         js_invoke_function_ubuuuu(j_calls->instance_ptr, 112, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14053 }
14054 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
14055         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14056         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
14057         LDKNodeFeatures ret_conv;
14058         ret_conv.inner = untag_ptr(ret);
14059         ret_conv.is_owned = ptr_is_owned(ret);
14060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14061         return ret_conv;
14062 }
14063 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14064         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14065         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14066         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14067         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14068         LDKInitFeatures ret_conv;
14069         ret_conv.inner = untag_ptr(ret);
14070         ret_conv.is_owned = ptr_is_owned(ret);
14071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14072         return ret_conv;
14073 }
14074 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
14075         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14076         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
14077         void* ret_ptr = untag_ptr(ret);
14078         CHECK_ACCESS(ret_ptr);
14079         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
14080         FREE(untag_ptr(ret));
14081         return ret_conv;
14082 }
14083 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
14084         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
14085         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14086         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14087 }
14088 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
14089         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
14090         atomic_init(&calls->refcnt, 1);
14091         calls->instance_ptr = o;
14092
14093         LDKChannelMessageHandler ret = {
14094                 .this_arg = (void*) calls,
14095                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
14096                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
14097                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
14098                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
14099                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
14100                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
14101                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
14102                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
14103                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
14104                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
14105                 .handle_splice = handle_splice_LDKChannelMessageHandler_jcall,
14106                 .handle_splice_ack = handle_splice_ack_LDKChannelMessageHandler_jcall,
14107                 .handle_splice_locked = handle_splice_locked_LDKChannelMessageHandler_jcall,
14108                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
14109                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
14110                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
14111                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
14112                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
14113                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
14114                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
14115                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
14116                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
14117                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
14118                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
14119                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
14120                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
14121                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
14122                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
14123                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
14124                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
14125                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
14126                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
14127                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
14128                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
14129                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
14130                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
14131                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
14132                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
14133                 .free = LDKChannelMessageHandler_JCalls_free,
14134                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
14135         };
14136         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
14137         return ret;
14138 }
14139 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
14140         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14141         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
14142         return tag_ptr(res_ptr, true);
14143 }
14144 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) {
14145         void* this_arg_ptr = untag_ptr(this_arg);
14146         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14147         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14148         LDKPublicKey their_node_id_ref;
14149         CHECK(their_node_id->arr_len == 33);
14150         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14151         LDKOpenChannel msg_conv;
14152         msg_conv.inner = untag_ptr(msg);
14153         msg_conv.is_owned = ptr_is_owned(msg);
14154         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14155         msg_conv.is_owned = false;
14156         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14157 }
14158
14159 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) {
14160         void* this_arg_ptr = untag_ptr(this_arg);
14161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14162         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14163         LDKPublicKey their_node_id_ref;
14164         CHECK(their_node_id->arr_len == 33);
14165         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14166         LDKOpenChannelV2 msg_conv;
14167         msg_conv.inner = untag_ptr(msg);
14168         msg_conv.is_owned = ptr_is_owned(msg);
14169         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14170         msg_conv.is_owned = false;
14171         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14172 }
14173
14174 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) {
14175         void* this_arg_ptr = untag_ptr(this_arg);
14176         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14177         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14178         LDKPublicKey their_node_id_ref;
14179         CHECK(their_node_id->arr_len == 33);
14180         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14181         LDKAcceptChannel msg_conv;
14182         msg_conv.inner = untag_ptr(msg);
14183         msg_conv.is_owned = ptr_is_owned(msg);
14184         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14185         msg_conv.is_owned = false;
14186         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14187 }
14188
14189 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) {
14190         void* this_arg_ptr = untag_ptr(this_arg);
14191         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14192         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14193         LDKPublicKey their_node_id_ref;
14194         CHECK(their_node_id->arr_len == 33);
14195         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14196         LDKAcceptChannelV2 msg_conv;
14197         msg_conv.inner = untag_ptr(msg);
14198         msg_conv.is_owned = ptr_is_owned(msg);
14199         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14200         msg_conv.is_owned = false;
14201         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14202 }
14203
14204 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) {
14205         void* this_arg_ptr = untag_ptr(this_arg);
14206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14207         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14208         LDKPublicKey their_node_id_ref;
14209         CHECK(their_node_id->arr_len == 33);
14210         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14211         LDKFundingCreated msg_conv;
14212         msg_conv.inner = untag_ptr(msg);
14213         msg_conv.is_owned = ptr_is_owned(msg);
14214         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14215         msg_conv.is_owned = false;
14216         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14217 }
14218
14219 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) {
14220         void* this_arg_ptr = untag_ptr(this_arg);
14221         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14222         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14223         LDKPublicKey their_node_id_ref;
14224         CHECK(their_node_id->arr_len == 33);
14225         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14226         LDKFundingSigned msg_conv;
14227         msg_conv.inner = untag_ptr(msg);
14228         msg_conv.is_owned = ptr_is_owned(msg);
14229         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14230         msg_conv.is_owned = false;
14231         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14232 }
14233
14234 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) {
14235         void* this_arg_ptr = untag_ptr(this_arg);
14236         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14237         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14238         LDKPublicKey their_node_id_ref;
14239         CHECK(their_node_id->arr_len == 33);
14240         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14241         LDKChannelReady msg_conv;
14242         msg_conv.inner = untag_ptr(msg);
14243         msg_conv.is_owned = ptr_is_owned(msg);
14244         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14245         msg_conv.is_owned = false;
14246         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14247 }
14248
14249 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14250         void* this_arg_ptr = untag_ptr(this_arg);
14251         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14252         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14253         LDKPublicKey their_node_id_ref;
14254         CHECK(their_node_id->arr_len == 33);
14255         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14256         LDKShutdown msg_conv;
14257         msg_conv.inner = untag_ptr(msg);
14258         msg_conv.is_owned = ptr_is_owned(msg);
14259         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14260         msg_conv.is_owned = false;
14261         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14262 }
14263
14264 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) {
14265         void* this_arg_ptr = untag_ptr(this_arg);
14266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14267         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14268         LDKPublicKey their_node_id_ref;
14269         CHECK(their_node_id->arr_len == 33);
14270         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14271         LDKClosingSigned msg_conv;
14272         msg_conv.inner = untag_ptr(msg);
14273         msg_conv.is_owned = ptr_is_owned(msg);
14274         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14275         msg_conv.is_owned = false;
14276         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14277 }
14278
14279 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_stfu"))) TS_ChannelMessageHandler_handle_stfu(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14280         void* this_arg_ptr = untag_ptr(this_arg);
14281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14282         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14283         LDKPublicKey their_node_id_ref;
14284         CHECK(their_node_id->arr_len == 33);
14285         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14286         LDKStfu msg_conv;
14287         msg_conv.inner = untag_ptr(msg);
14288         msg_conv.is_owned = ptr_is_owned(msg);
14289         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14290         msg_conv.is_owned = false;
14291         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14292 }
14293
14294 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_splice"))) TS_ChannelMessageHandler_handle_splice(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14295         void* this_arg_ptr = untag_ptr(this_arg);
14296         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14297         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14298         LDKPublicKey their_node_id_ref;
14299         CHECK(their_node_id->arr_len == 33);
14300         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14301         LDKSplice msg_conv;
14302         msg_conv.inner = untag_ptr(msg);
14303         msg_conv.is_owned = ptr_is_owned(msg);
14304         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14305         msg_conv.is_owned = false;
14306         (this_arg_conv->handle_splice)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14307 }
14308
14309 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_splice_ack"))) TS_ChannelMessageHandler_handle_splice_ack(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14310         void* this_arg_ptr = untag_ptr(this_arg);
14311         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14312         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14313         LDKPublicKey their_node_id_ref;
14314         CHECK(their_node_id->arr_len == 33);
14315         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14316         LDKSpliceAck msg_conv;
14317         msg_conv.inner = untag_ptr(msg);
14318         msg_conv.is_owned = ptr_is_owned(msg);
14319         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14320         msg_conv.is_owned = false;
14321         (this_arg_conv->handle_splice_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14322 }
14323
14324 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_splice_locked"))) TS_ChannelMessageHandler_handle_splice_locked(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14325         void* this_arg_ptr = untag_ptr(this_arg);
14326         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14327         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14328         LDKPublicKey their_node_id_ref;
14329         CHECK(their_node_id->arr_len == 33);
14330         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14331         LDKSpliceLocked msg_conv;
14332         msg_conv.inner = untag_ptr(msg);
14333         msg_conv.is_owned = ptr_is_owned(msg);
14334         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14335         msg_conv.is_owned = false;
14336         (this_arg_conv->handle_splice_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14337 }
14338
14339 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) {
14340         void* this_arg_ptr = untag_ptr(this_arg);
14341         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14342         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14343         LDKPublicKey their_node_id_ref;
14344         CHECK(their_node_id->arr_len == 33);
14345         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14346         LDKTxAddInput msg_conv;
14347         msg_conv.inner = untag_ptr(msg);
14348         msg_conv.is_owned = ptr_is_owned(msg);
14349         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14350         msg_conv.is_owned = false;
14351         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14352 }
14353
14354 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) {
14355         void* this_arg_ptr = untag_ptr(this_arg);
14356         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14357         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14358         LDKPublicKey their_node_id_ref;
14359         CHECK(their_node_id->arr_len == 33);
14360         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14361         LDKTxAddOutput msg_conv;
14362         msg_conv.inner = untag_ptr(msg);
14363         msg_conv.is_owned = ptr_is_owned(msg);
14364         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14365         msg_conv.is_owned = false;
14366         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14367 }
14368
14369 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) {
14370         void* this_arg_ptr = untag_ptr(this_arg);
14371         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14372         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14373         LDKPublicKey their_node_id_ref;
14374         CHECK(their_node_id->arr_len == 33);
14375         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14376         LDKTxRemoveInput msg_conv;
14377         msg_conv.inner = untag_ptr(msg);
14378         msg_conv.is_owned = ptr_is_owned(msg);
14379         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14380         msg_conv.is_owned = false;
14381         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14382 }
14383
14384 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) {
14385         void* this_arg_ptr = untag_ptr(this_arg);
14386         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14387         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14388         LDKPublicKey their_node_id_ref;
14389         CHECK(their_node_id->arr_len == 33);
14390         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14391         LDKTxRemoveOutput msg_conv;
14392         msg_conv.inner = untag_ptr(msg);
14393         msg_conv.is_owned = ptr_is_owned(msg);
14394         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14395         msg_conv.is_owned = false;
14396         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14397 }
14398
14399 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) {
14400         void* this_arg_ptr = untag_ptr(this_arg);
14401         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14402         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14403         LDKPublicKey their_node_id_ref;
14404         CHECK(their_node_id->arr_len == 33);
14405         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14406         LDKTxComplete msg_conv;
14407         msg_conv.inner = untag_ptr(msg);
14408         msg_conv.is_owned = ptr_is_owned(msg);
14409         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14410         msg_conv.is_owned = false;
14411         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14412 }
14413
14414 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) {
14415         void* this_arg_ptr = untag_ptr(this_arg);
14416         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14417         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14418         LDKPublicKey their_node_id_ref;
14419         CHECK(their_node_id->arr_len == 33);
14420         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14421         LDKTxSignatures msg_conv;
14422         msg_conv.inner = untag_ptr(msg);
14423         msg_conv.is_owned = ptr_is_owned(msg);
14424         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14425         msg_conv.is_owned = false;
14426         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14427 }
14428
14429 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) {
14430         void* this_arg_ptr = untag_ptr(this_arg);
14431         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14432         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14433         LDKPublicKey their_node_id_ref;
14434         CHECK(their_node_id->arr_len == 33);
14435         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14436         LDKTxInitRbf msg_conv;
14437         msg_conv.inner = untag_ptr(msg);
14438         msg_conv.is_owned = ptr_is_owned(msg);
14439         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14440         msg_conv.is_owned = false;
14441         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14442 }
14443
14444 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) {
14445         void* this_arg_ptr = untag_ptr(this_arg);
14446         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14447         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14448         LDKPublicKey their_node_id_ref;
14449         CHECK(their_node_id->arr_len == 33);
14450         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14451         LDKTxAckRbf msg_conv;
14452         msg_conv.inner = untag_ptr(msg);
14453         msg_conv.is_owned = ptr_is_owned(msg);
14454         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14455         msg_conv.is_owned = false;
14456         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14457 }
14458
14459 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) {
14460         void* this_arg_ptr = untag_ptr(this_arg);
14461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14462         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14463         LDKPublicKey their_node_id_ref;
14464         CHECK(their_node_id->arr_len == 33);
14465         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14466         LDKTxAbort msg_conv;
14467         msg_conv.inner = untag_ptr(msg);
14468         msg_conv.is_owned = ptr_is_owned(msg);
14469         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14470         msg_conv.is_owned = false;
14471         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14472 }
14473
14474 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) {
14475         void* this_arg_ptr = untag_ptr(this_arg);
14476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14477         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14478         LDKPublicKey their_node_id_ref;
14479         CHECK(their_node_id->arr_len == 33);
14480         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14481         LDKUpdateAddHTLC msg_conv;
14482         msg_conv.inner = untag_ptr(msg);
14483         msg_conv.is_owned = ptr_is_owned(msg);
14484         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14485         msg_conv.is_owned = false;
14486         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14487 }
14488
14489 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) {
14490         void* this_arg_ptr = untag_ptr(this_arg);
14491         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14492         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14493         LDKPublicKey their_node_id_ref;
14494         CHECK(their_node_id->arr_len == 33);
14495         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14496         LDKUpdateFulfillHTLC msg_conv;
14497         msg_conv.inner = untag_ptr(msg);
14498         msg_conv.is_owned = ptr_is_owned(msg);
14499         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14500         msg_conv.is_owned = false;
14501         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14502 }
14503
14504 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) {
14505         void* this_arg_ptr = untag_ptr(this_arg);
14506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14507         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14508         LDKPublicKey their_node_id_ref;
14509         CHECK(their_node_id->arr_len == 33);
14510         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14511         LDKUpdateFailHTLC msg_conv;
14512         msg_conv.inner = untag_ptr(msg);
14513         msg_conv.is_owned = ptr_is_owned(msg);
14514         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14515         msg_conv.is_owned = false;
14516         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14517 }
14518
14519 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) {
14520         void* this_arg_ptr = untag_ptr(this_arg);
14521         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14522         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14523         LDKPublicKey their_node_id_ref;
14524         CHECK(their_node_id->arr_len == 33);
14525         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14526         LDKUpdateFailMalformedHTLC msg_conv;
14527         msg_conv.inner = untag_ptr(msg);
14528         msg_conv.is_owned = ptr_is_owned(msg);
14529         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14530         msg_conv.is_owned = false;
14531         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14532 }
14533
14534 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) {
14535         void* this_arg_ptr = untag_ptr(this_arg);
14536         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14537         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14538         LDKPublicKey their_node_id_ref;
14539         CHECK(their_node_id->arr_len == 33);
14540         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14541         LDKCommitmentSigned msg_conv;
14542         msg_conv.inner = untag_ptr(msg);
14543         msg_conv.is_owned = ptr_is_owned(msg);
14544         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14545         msg_conv.is_owned = false;
14546         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14547 }
14548
14549 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) {
14550         void* this_arg_ptr = untag_ptr(this_arg);
14551         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14552         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14553         LDKPublicKey their_node_id_ref;
14554         CHECK(their_node_id->arr_len == 33);
14555         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14556         LDKRevokeAndACK msg_conv;
14557         msg_conv.inner = untag_ptr(msg);
14558         msg_conv.is_owned = ptr_is_owned(msg);
14559         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14560         msg_conv.is_owned = false;
14561         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14562 }
14563
14564 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) {
14565         void* this_arg_ptr = untag_ptr(this_arg);
14566         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14567         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14568         LDKPublicKey their_node_id_ref;
14569         CHECK(their_node_id->arr_len == 33);
14570         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14571         LDKUpdateFee msg_conv;
14572         msg_conv.inner = untag_ptr(msg);
14573         msg_conv.is_owned = ptr_is_owned(msg);
14574         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14575         msg_conv.is_owned = false;
14576         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14577 }
14578
14579 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) {
14580         void* this_arg_ptr = untag_ptr(this_arg);
14581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14582         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14583         LDKPublicKey their_node_id_ref;
14584         CHECK(their_node_id->arr_len == 33);
14585         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14586         LDKAnnouncementSignatures msg_conv;
14587         msg_conv.inner = untag_ptr(msg);
14588         msg_conv.is_owned = ptr_is_owned(msg);
14589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14590         msg_conv.is_owned = false;
14591         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14592 }
14593
14594 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
14595         void* this_arg_ptr = untag_ptr(this_arg);
14596         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14597         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14598         LDKPublicKey their_node_id_ref;
14599         CHECK(their_node_id->arr_len == 33);
14600         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14601         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14602 }
14603
14604 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) {
14605         void* this_arg_ptr = untag_ptr(this_arg);
14606         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14607         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14608         LDKPublicKey their_node_id_ref;
14609         CHECK(their_node_id->arr_len == 33);
14610         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14611         LDKInit msg_conv;
14612         msg_conv.inner = untag_ptr(msg);
14613         msg_conv.is_owned = ptr_is_owned(msg);
14614         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14615         msg_conv.is_owned = false;
14616         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14617         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
14618         return tag_ptr(ret_conv, true);
14619 }
14620
14621 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) {
14622         void* this_arg_ptr = untag_ptr(this_arg);
14623         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14624         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14625         LDKPublicKey their_node_id_ref;
14626         CHECK(their_node_id->arr_len == 33);
14627         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14628         LDKChannelReestablish msg_conv;
14629         msg_conv.inner = untag_ptr(msg);
14630         msg_conv.is_owned = ptr_is_owned(msg);
14631         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14632         msg_conv.is_owned = false;
14633         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14634 }
14635
14636 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) {
14637         void* this_arg_ptr = untag_ptr(this_arg);
14638         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14639         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14640         LDKPublicKey their_node_id_ref;
14641         CHECK(their_node_id->arr_len == 33);
14642         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14643         LDKChannelUpdate msg_conv;
14644         msg_conv.inner = untag_ptr(msg);
14645         msg_conv.is_owned = ptr_is_owned(msg);
14646         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14647         msg_conv.is_owned = false;
14648         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14649 }
14650
14651 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14652         void* this_arg_ptr = untag_ptr(this_arg);
14653         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14654         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14655         LDKPublicKey their_node_id_ref;
14656         CHECK(their_node_id->arr_len == 33);
14657         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14658         LDKErrorMessage msg_conv;
14659         msg_conv.inner = untag_ptr(msg);
14660         msg_conv.is_owned = ptr_is_owned(msg);
14661         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14662         msg_conv.is_owned = false;
14663         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14664 }
14665
14666 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
14667         void* this_arg_ptr = untag_ptr(this_arg);
14668         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14669         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14670         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14671         uint64_t ret_ref = 0;
14672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14674         return ret_ref;
14675 }
14676
14677 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14678         void* this_arg_ptr = untag_ptr(this_arg);
14679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14680         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14681         LDKPublicKey their_node_id_ref;
14682         CHECK(their_node_id->arr_len == 33);
14683         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14684         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14685         uint64_t ret_ref = 0;
14686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14688         return ret_ref;
14689 }
14690
14691 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
14692         void* this_arg_ptr = untag_ptr(this_arg);
14693         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14694         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14695         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
14696         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
14697         uint64_t ret_ref = tag_ptr(ret_copy, true);
14698         return ret_ref;
14699 }
14700
14701 typedef struct LDKOffersMessageHandler_JCalls {
14702         atomic_size_t refcnt;
14703         uint32_t instance_ptr;
14704 } LDKOffersMessageHandler_JCalls;
14705 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
14706         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14707         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14708                 FREE(j_calls);
14709         }
14710 }
14711 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
14712         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14713         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14714         *message_copy = message;
14715         uint64_t message_ref = tag_ptr(message_copy, true);
14716         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, message_ref, 0, 0, 0, 0, 0);
14717         void* ret_ptr = untag_ptr(ret);
14718         CHECK_ACCESS(ret_ptr);
14719         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
14720         FREE(untag_ptr(ret));
14721         return ret_conv;
14722 }
14723 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
14724         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14725         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
14726         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
14727         ret_constr.datalen = ret->arr_len;
14728         if (ret_constr.datalen > 0)
14729                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
14730         else
14731                 ret_constr.data = NULL;
14732         uint64_t* ret_vals = ret->elems;
14733         for (size_t x = 0; x < ret_constr.datalen; x++) {
14734                 uint64_t ret_conv_49 = ret_vals[x];
14735                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
14736                 CHECK_ACCESS(ret_conv_49_ptr);
14737                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
14738                 FREE(untag_ptr(ret_conv_49));
14739                 ret_constr.data[x] = ret_conv_49_conv;
14740         }
14741         FREE(ret);
14742         return ret_constr;
14743 }
14744 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
14745         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
14746         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14747 }
14748 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
14749         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
14750         atomic_init(&calls->refcnt, 1);
14751         calls->instance_ptr = o;
14752
14753         LDKOffersMessageHandler ret = {
14754                 .this_arg = (void*) calls,
14755                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
14756                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
14757                 .free = LDKOffersMessageHandler_JCalls_free,
14758         };
14759         return ret;
14760 }
14761 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
14762         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
14763         *res_ptr = LDKOffersMessageHandler_init(o);
14764         return tag_ptr(res_ptr, true);
14765 }
14766 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
14767         void* this_arg_ptr = untag_ptr(this_arg);
14768         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14769         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
14770         void* message_ptr = untag_ptr(message);
14771         CHECK_ACCESS(message_ptr);
14772         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
14773         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
14774         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14775         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
14776         uint64_t ret_ref = tag_ptr(ret_copy, true);
14777         return ret_ref;
14778 }
14779
14780 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
14781         void* this_arg_ptr = untag_ptr(this_arg);
14782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14783         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
14784         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
14785         uint64_tArray ret_arr = NULL;
14786         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14787         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14788         for (size_t x = 0; x < ret_var.datalen; x++) {
14789                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
14790                 *ret_conv_49_conv = ret_var.data[x];
14791                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
14792         }
14793         
14794         FREE(ret_var.data);
14795         return ret_arr;
14796 }
14797
14798 typedef struct LDKRoutingMessageHandler_JCalls {
14799         atomic_size_t refcnt;
14800         uint32_t instance_ptr;
14801         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
14802 } LDKRoutingMessageHandler_JCalls;
14803 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
14804         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14805         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14806                 FREE(j_calls);
14807         }
14808 }
14809 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
14810         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14811         LDKNodeAnnouncement msg_var = *msg;
14812         uint64_t msg_ref = 0;
14813         msg_var = NodeAnnouncement_clone(&msg_var);
14814         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14815         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14816         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 118, msg_ref, 0, 0, 0, 0, 0);
14817         void* ret_ptr = untag_ptr(ret);
14818         CHECK_ACCESS(ret_ptr);
14819         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14820         FREE(untag_ptr(ret));
14821         return ret_conv;
14822 }
14823 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
14824         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14825         LDKChannelAnnouncement msg_var = *msg;
14826         uint64_t msg_ref = 0;
14827         msg_var = ChannelAnnouncement_clone(&msg_var);
14828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14829         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14830         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 119, msg_ref, 0, 0, 0, 0, 0);
14831         void* ret_ptr = untag_ptr(ret);
14832         CHECK_ACCESS(ret_ptr);
14833         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14834         FREE(untag_ptr(ret));
14835         return ret_conv;
14836 }
14837 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
14838         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14839         LDKChannelUpdate msg_var = *msg;
14840         uint64_t msg_ref = 0;
14841         msg_var = ChannelUpdate_clone(&msg_var);
14842         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14843         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14844         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 120, msg_ref, 0, 0, 0, 0, 0);
14845         void* ret_ptr = untag_ptr(ret);
14846         CHECK_ACCESS(ret_ptr);
14847         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14848         FREE(untag_ptr(ret));
14849         return ret_conv;
14850 }
14851 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
14852         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14853         int64_t starting_point_conv = starting_point;
14854         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, starting_point_conv, 0, 0, 0, 0, 0);
14855         void* ret_ptr = untag_ptr(ret);
14856         CHECK_ACCESS(ret_ptr);
14857         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
14858         FREE(untag_ptr(ret));
14859         return ret_conv;
14860 }
14861 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
14862         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14863         LDKNodeId starting_point_var = starting_point;
14864         uint64_t starting_point_ref = 0;
14865         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
14866         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
14867         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, starting_point_ref, 0, 0, 0, 0, 0);
14868         LDKNodeAnnouncement ret_conv;
14869         ret_conv.inner = untag_ptr(ret);
14870         ret_conv.is_owned = ptr_is_owned(ret);
14871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14872         return ret_conv;
14873 }
14874 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
14875         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14876         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14877         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14878         LDKInit init_var = *init;
14879         uint64_t init_ref = 0;
14880         init_var = Init_clone(&init_var);
14881         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
14882         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
14883         jboolean inbound_conv = inbound;
14884         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 123, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
14885         void* ret_ptr = untag_ptr(ret);
14886         CHECK_ACCESS(ret_ptr);
14887         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14888         FREE(untag_ptr(ret));
14889         return ret_conv;
14890 }
14891 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
14892         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14893         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14894         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14895         LDKReplyChannelRange msg_var = msg;
14896         uint64_t msg_ref = 0;
14897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14898         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14899         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 124, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14900         void* ret_ptr = untag_ptr(ret);
14901         CHECK_ACCESS(ret_ptr);
14902         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14903         FREE(untag_ptr(ret));
14904         return ret_conv;
14905 }
14906 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
14907         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14908         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14909         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14910         LDKReplyShortChannelIdsEnd msg_var = msg;
14911         uint64_t msg_ref = 0;
14912         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14913         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14914         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14915         void* ret_ptr = untag_ptr(ret);
14916         CHECK_ACCESS(ret_ptr);
14917         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14918         FREE(untag_ptr(ret));
14919         return ret_conv;
14920 }
14921 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
14922         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14923         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14924         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14925         LDKQueryChannelRange msg_var = msg;
14926         uint64_t msg_ref = 0;
14927         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14928         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14929         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 126, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14930         void* ret_ptr = untag_ptr(ret);
14931         CHECK_ACCESS(ret_ptr);
14932         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14933         FREE(untag_ptr(ret));
14934         return ret_conv;
14935 }
14936 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
14937         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14938         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14939         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14940         LDKQueryShortChannelIds msg_var = msg;
14941         uint64_t msg_ref = 0;
14942         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14943         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14944         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14945         void* ret_ptr = untag_ptr(ret);
14946         CHECK_ACCESS(ret_ptr);
14947         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14948         FREE(untag_ptr(ret));
14949         return ret_conv;
14950 }
14951 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
14952         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14953         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, 0, 0, 0, 0, 0, 0);
14954 }
14955 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
14956         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14957         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
14958         LDKNodeFeatures ret_conv;
14959         ret_conv.inner = untag_ptr(ret);
14960         ret_conv.is_owned = ptr_is_owned(ret);
14961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14962         return ret_conv;
14963 }
14964 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14965         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14966         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14967         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14968         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14969         LDKInitFeatures ret_conv;
14970         ret_conv.inner = untag_ptr(ret);
14971         ret_conv.is_owned = ptr_is_owned(ret);
14972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14973         return ret_conv;
14974 }
14975 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
14976         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
14977         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14978         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14979 }
14980 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
14981         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
14982         atomic_init(&calls->refcnt, 1);
14983         calls->instance_ptr = o;
14984
14985         LDKRoutingMessageHandler ret = {
14986                 .this_arg = (void*) calls,
14987                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
14988                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
14989                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
14990                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
14991                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
14992                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
14993                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
14994                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
14995                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
14996                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
14997                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
14998                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
14999                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
15000                 .free = LDKRoutingMessageHandler_JCalls_free,
15001                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15002         };
15003         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15004         return ret;
15005 }
15006 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
15007         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
15008         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
15009         return tag_ptr(res_ptr, true);
15010 }
15011 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
15012         void* this_arg_ptr = untag_ptr(this_arg);
15013         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15014         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15015         LDKNodeAnnouncement msg_conv;
15016         msg_conv.inner = untag_ptr(msg);
15017         msg_conv.is_owned = ptr_is_owned(msg);
15018         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15019         msg_conv.is_owned = false;
15020         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15021         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
15022         return tag_ptr(ret_conv, true);
15023 }
15024
15025 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
15026         void* this_arg_ptr = untag_ptr(this_arg);
15027         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15028         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15029         LDKChannelAnnouncement msg_conv;
15030         msg_conv.inner = untag_ptr(msg);
15031         msg_conv.is_owned = ptr_is_owned(msg);
15032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15033         msg_conv.is_owned = false;
15034         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15035         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
15036         return tag_ptr(ret_conv, true);
15037 }
15038
15039 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
15040         void* this_arg_ptr = untag_ptr(this_arg);
15041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15042         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15043         LDKChannelUpdate msg_conv;
15044         msg_conv.inner = untag_ptr(msg);
15045         msg_conv.is_owned = ptr_is_owned(msg);
15046         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15047         msg_conv.is_owned = false;
15048         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15049         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
15050         return tag_ptr(ret_conv, true);
15051 }
15052
15053 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) {
15054         void* this_arg_ptr = untag_ptr(this_arg);
15055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15056         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15057         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15058         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
15059         uint64_t ret_ref = tag_ptr(ret_copy, true);
15060         return ret_ref;
15061 }
15062
15063 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) {
15064         void* this_arg_ptr = untag_ptr(this_arg);
15065         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15066         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15067         LDKNodeId starting_point_conv;
15068         starting_point_conv.inner = untag_ptr(starting_point);
15069         starting_point_conv.is_owned = ptr_is_owned(starting_point);
15070         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
15071         starting_point_conv = NodeId_clone(&starting_point_conv);
15072         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
15073         uint64_t ret_ref = 0;
15074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15076         return ret_ref;
15077 }
15078
15079 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) {
15080         void* this_arg_ptr = untag_ptr(this_arg);
15081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15082         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15083         LDKPublicKey their_node_id_ref;
15084         CHECK(their_node_id->arr_len == 33);
15085         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15086         LDKInit init_conv;
15087         init_conv.inner = untag_ptr(init);
15088         init_conv.is_owned = ptr_is_owned(init);
15089         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15090         init_conv.is_owned = false;
15091         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15092         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15093         return tag_ptr(ret_conv, true);
15094 }
15095
15096 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) {
15097         void* this_arg_ptr = untag_ptr(this_arg);
15098         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15099         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15100         LDKPublicKey their_node_id_ref;
15101         CHECK(their_node_id->arr_len == 33);
15102         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15103         LDKReplyChannelRange msg_conv;
15104         msg_conv.inner = untag_ptr(msg);
15105         msg_conv.is_owned = ptr_is_owned(msg);
15106         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15107         msg_conv = ReplyChannelRange_clone(&msg_conv);
15108         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15109         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15110         return tag_ptr(ret_conv, true);
15111 }
15112
15113 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) {
15114         void* this_arg_ptr = untag_ptr(this_arg);
15115         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15116         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15117         LDKPublicKey their_node_id_ref;
15118         CHECK(their_node_id->arr_len == 33);
15119         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15120         LDKReplyShortChannelIdsEnd msg_conv;
15121         msg_conv.inner = untag_ptr(msg);
15122         msg_conv.is_owned = ptr_is_owned(msg);
15123         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15124         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
15125         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15126         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15127         return tag_ptr(ret_conv, true);
15128 }
15129
15130 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) {
15131         void* this_arg_ptr = untag_ptr(this_arg);
15132         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15133         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15134         LDKPublicKey their_node_id_ref;
15135         CHECK(their_node_id->arr_len == 33);
15136         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15137         LDKQueryChannelRange msg_conv;
15138         msg_conv.inner = untag_ptr(msg);
15139         msg_conv.is_owned = ptr_is_owned(msg);
15140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15141         msg_conv = QueryChannelRange_clone(&msg_conv);
15142         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15143         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15144         return tag_ptr(ret_conv, true);
15145 }
15146
15147 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) {
15148         void* this_arg_ptr = untag_ptr(this_arg);
15149         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15150         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15151         LDKPublicKey their_node_id_ref;
15152         CHECK(their_node_id->arr_len == 33);
15153         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15154         LDKQueryShortChannelIds msg_conv;
15155         msg_conv.inner = untag_ptr(msg);
15156         msg_conv.is_owned = ptr_is_owned(msg);
15157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15158         msg_conv = QueryShortChannelIds_clone(&msg_conv);
15159         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15160         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15161         return tag_ptr(ret_conv, true);
15162 }
15163
15164 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
15165         void* this_arg_ptr = untag_ptr(this_arg);
15166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15167         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15168         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
15169         return ret_conv;
15170 }
15171
15172 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
15173         void* this_arg_ptr = untag_ptr(this_arg);
15174         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15175         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15176         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15177         uint64_t ret_ref = 0;
15178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15180         return ret_ref;
15181 }
15182
15183 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15184         void* this_arg_ptr = untag_ptr(this_arg);
15185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15186         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15187         LDKPublicKey their_node_id_ref;
15188         CHECK(their_node_id->arr_len == 33);
15189         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15190         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15191         uint64_t ret_ref = 0;
15192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15194         return ret_ref;
15195 }
15196
15197 typedef struct LDKOnionMessageHandler_JCalls {
15198         atomic_size_t refcnt;
15199         uint32_t instance_ptr;
15200 } LDKOnionMessageHandler_JCalls;
15201 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
15202         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15203         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15204                 FREE(j_calls);
15205         }
15206 }
15207 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
15208         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15209         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, 0, 0, 0, 0, 0, 0);
15210         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
15211         ret_constr.datalen = ret->arr_len;
15212         if (ret_constr.datalen > 0)
15213                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
15214         else
15215                 ret_constr.data = NULL;
15216         uint64_t* ret_vals = ret->elems;
15217         for (size_t o = 0; o < ret_constr.datalen; o++) {
15218                 uint64_t ret_conv_40 = ret_vals[o];
15219                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
15220                 CHECK_ACCESS(ret_conv_40_ptr);
15221                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
15222                 FREE(untag_ptr(ret_conv_40));
15223                 ret_constr.data[o] = ret_conv_40_conv;
15224         }
15225         FREE(ret);
15226         return ret_constr;
15227 }
15228 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
15229         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15230         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15231         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15232         LDKOnionMessage msg_var = *msg;
15233         uint64_t msg_ref = 0;
15234         msg_var = OnionMessage_clone(&msg_var);
15235         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15236         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15237         js_invoke_function_ubuuuu(j_calls->instance_ptr, 132, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
15238 }
15239 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
15240         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15241         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15242         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15243         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 133, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
15244         LDKOnionMessage ret_conv;
15245         ret_conv.inner = untag_ptr(ret);
15246         ret_conv.is_owned = ptr_is_owned(ret);
15247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15248         return ret_conv;
15249 }
15250 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
15251         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15252         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15253         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15254         LDKInit init_var = *init;
15255         uint64_t init_ref = 0;
15256         init_var = Init_clone(&init_var);
15257         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
15258         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
15259         jboolean inbound_conv = inbound;
15260         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 134, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
15261         void* ret_ptr = untag_ptr(ret);
15262         CHECK_ACCESS(ret_ptr);
15263         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15264         FREE(untag_ptr(ret));
15265         return ret_conv;
15266 }
15267 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15268         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15269         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15270         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15271         js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15272 }
15273 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
15274         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15275         js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, 0, 0, 0, 0, 0, 0);
15276 }
15277 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
15278         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15279         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
15280         LDKNodeFeatures ret_conv;
15281         ret_conv.inner = untag_ptr(ret);
15282         ret_conv.is_owned = ptr_is_owned(ret);
15283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15284         return ret_conv;
15285 }
15286 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15287         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15288         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15289         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15290         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15291         LDKInitFeatures ret_conv;
15292         ret_conv.inner = untag_ptr(ret);
15293         ret_conv.is_owned = ptr_is_owned(ret);
15294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15295         return ret_conv;
15296 }
15297 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
15298         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
15299         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15300 }
15301 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
15302         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
15303         atomic_init(&calls->refcnt, 1);
15304         calls->instance_ptr = o;
15305
15306         LDKOnionMessageHandler ret = {
15307                 .this_arg = (void*) calls,
15308                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
15309                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
15310                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
15311                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
15312                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
15313                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
15314                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
15315                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
15316                 .free = LDKOnionMessageHandler_JCalls_free,
15317         };
15318         return ret;
15319 }
15320 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
15321         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
15322         *res_ptr = LDKOnionMessageHandler_init(o);
15323         return tag_ptr(res_ptr, true);
15324 }
15325 uint64_tArray  __attribute__((export_name("TS_OnionMessageHandler_get_and_clear_connections_needed"))) TS_OnionMessageHandler_get_and_clear_connections_needed(uint64_t this_arg) {
15326         void* this_arg_ptr = untag_ptr(this_arg);
15327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15328         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15329         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
15330         uint64_tArray ret_arr = NULL;
15331         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15332         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15333         for (size_t o = 0; o < ret_var.datalen; o++) {
15334                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
15335                 *ret_conv_40_conv = ret_var.data[o];
15336                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
15337         }
15338         
15339         FREE(ret_var.data);
15340         return ret_arr;
15341 }
15342
15343 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) {
15344         void* this_arg_ptr = untag_ptr(this_arg);
15345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15346         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15347         LDKPublicKey peer_node_id_ref;
15348         CHECK(peer_node_id->arr_len == 33);
15349         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15350         LDKOnionMessage msg_conv;
15351         msg_conv.inner = untag_ptr(msg);
15352         msg_conv.is_owned = ptr_is_owned(msg);
15353         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15354         msg_conv.is_owned = false;
15355         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
15356 }
15357
15358 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) {
15359         void* this_arg_ptr = untag_ptr(this_arg);
15360         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15361         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15362         LDKPublicKey peer_node_id_ref;
15363         CHECK(peer_node_id->arr_len == 33);
15364         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15365         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
15366         uint64_t ret_ref = 0;
15367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15369         return ret_ref;
15370 }
15371
15372 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) {
15373         void* this_arg_ptr = untag_ptr(this_arg);
15374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15375         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15376         LDKPublicKey their_node_id_ref;
15377         CHECK(their_node_id->arr_len == 33);
15378         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15379         LDKInit init_conv;
15380         init_conv.inner = untag_ptr(init);
15381         init_conv.is_owned = ptr_is_owned(init);
15382         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15383         init_conv.is_owned = false;
15384         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15385         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15386         return tag_ptr(ret_conv, true);
15387 }
15388
15389 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
15390         void* this_arg_ptr = untag_ptr(this_arg);
15391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15392         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15393         LDKPublicKey their_node_id_ref;
15394         CHECK(their_node_id->arr_len == 33);
15395         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15396         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
15397 }
15398
15399 void  __attribute__((export_name("TS_OnionMessageHandler_timer_tick_occurred"))) TS_OnionMessageHandler_timer_tick_occurred(uint64_t this_arg) {
15400         void* this_arg_ptr = untag_ptr(this_arg);
15401         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15402         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15403         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
15404 }
15405
15406 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
15407         void* this_arg_ptr = untag_ptr(this_arg);
15408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15409         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15410         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15411         uint64_t ret_ref = 0;
15412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15414         return ret_ref;
15415 }
15416
15417 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15418         void* this_arg_ptr = untag_ptr(this_arg);
15419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15420         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15421         LDKPublicKey their_node_id_ref;
15422         CHECK(their_node_id->arr_len == 33);
15423         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15424         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15425         uint64_t ret_ref = 0;
15426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15428         return ret_ref;
15429 }
15430
15431 typedef struct LDKCustomMessageReader_JCalls {
15432         atomic_size_t refcnt;
15433         uint32_t instance_ptr;
15434 } LDKCustomMessageReader_JCalls;
15435 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
15436         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15437         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15438                 FREE(j_calls);
15439         }
15440 }
15441 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
15442         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15443         int16_t message_type_conv = message_type;
15444         LDKu8slice buffer_var = buffer;
15445         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15446         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15447         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
15448         void* ret_ptr = untag_ptr(ret);
15449         CHECK_ACCESS(ret_ptr);
15450         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
15451         FREE(untag_ptr(ret));
15452         return ret_conv;
15453 }
15454 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
15455         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
15456         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15457 }
15458 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
15459         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
15460         atomic_init(&calls->refcnt, 1);
15461         calls->instance_ptr = o;
15462
15463         LDKCustomMessageReader ret = {
15464                 .this_arg = (void*) calls,
15465                 .read = read_LDKCustomMessageReader_jcall,
15466                 .free = LDKCustomMessageReader_JCalls_free,
15467         };
15468         return ret;
15469 }
15470 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
15471         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
15472         *res_ptr = LDKCustomMessageReader_init(o);
15473         return tag_ptr(res_ptr, true);
15474 }
15475 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
15476         void* this_arg_ptr = untag_ptr(this_arg);
15477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15478         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
15479         LDKu8slice buffer_ref;
15480         buffer_ref.datalen = buffer->arr_len;
15481         buffer_ref.data = buffer->elems;
15482         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15483         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
15484         FREE(buffer);
15485         return tag_ptr(ret_conv, true);
15486 }
15487
15488 typedef struct LDKCustomMessageHandler_JCalls {
15489         atomic_size_t refcnt;
15490         uint32_t instance_ptr;
15491         LDKCustomMessageReader_JCalls* CustomMessageReader;
15492 } LDKCustomMessageHandler_JCalls;
15493 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
15494         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15495         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15496                 FREE(j_calls);
15497         }
15498 }
15499 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
15500         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15501         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
15502         *msg_ret = msg;
15503         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
15504         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
15505         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 140, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
15506         void* ret_ptr = untag_ptr(ret);
15507         CHECK_ACCESS(ret_ptr);
15508         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15509         FREE(untag_ptr(ret));
15510         return ret_conv;
15511 }
15512 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
15513         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15514         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 141, 0, 0, 0, 0, 0, 0);
15515         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
15516         ret_constr.datalen = ret->arr_len;
15517         if (ret_constr.datalen > 0)
15518                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
15519         else
15520                 ret_constr.data = NULL;
15521         uint64_t* ret_vals = ret->elems;
15522         for (size_t z = 0; z < ret_constr.datalen; z++) {
15523                 uint64_t ret_conv_25 = ret_vals[z];
15524                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
15525                 CHECK_ACCESS(ret_conv_25_ptr);
15526                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
15527                 FREE(untag_ptr(ret_conv_25));
15528                 ret_constr.data[z] = ret_conv_25_conv;
15529         }
15530         FREE(ret);
15531         return ret_constr;
15532 }
15533 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
15534         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15535         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
15536         LDKNodeFeatures ret_conv;
15537         ret_conv.inner = untag_ptr(ret);
15538         ret_conv.is_owned = ptr_is_owned(ret);
15539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15540         return ret_conv;
15541 }
15542 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15543         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15544         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15545         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15546         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15547         LDKInitFeatures ret_conv;
15548         ret_conv.inner = untag_ptr(ret);
15549         ret_conv.is_owned = ptr_is_owned(ret);
15550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15551         return ret_conv;
15552 }
15553 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
15554         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
15555         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15556         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
15557 }
15558 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
15559         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
15560         atomic_init(&calls->refcnt, 1);
15561         calls->instance_ptr = o;
15562
15563         LDKCustomMessageHandler ret = {
15564                 .this_arg = (void*) calls,
15565                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
15566                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
15567                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
15568                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
15569                 .free = LDKCustomMessageHandler_JCalls_free,
15570                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
15571         };
15572         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
15573         return ret;
15574 }
15575 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
15576         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
15577         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
15578         return tag_ptr(res_ptr, true);
15579 }
15580 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) {
15581         void* this_arg_ptr = untag_ptr(this_arg);
15582         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15583         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15584         void* msg_ptr = untag_ptr(msg);
15585         CHECK_ACCESS(msg_ptr);
15586         LDKType msg_conv = *(LDKType*)(msg_ptr);
15587         if (msg_conv.free == LDKType_JCalls_free) {
15588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15589                 LDKType_JCalls_cloned(&msg_conv);
15590         }
15591         LDKPublicKey sender_node_id_ref;
15592         CHECK(sender_node_id->arr_len == 33);
15593         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
15594         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15595         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
15596         return tag_ptr(ret_conv, true);
15597 }
15598
15599 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
15600         void* this_arg_ptr = untag_ptr(this_arg);
15601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15602         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15603         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
15604         uint64_tArray ret_arr = NULL;
15605         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15606         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15607         for (size_t z = 0; z < ret_var.datalen; z++) {
15608                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15609                 *ret_conv_25_conv = ret_var.data[z];
15610                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
15611         }
15612         
15613         FREE(ret_var.data);
15614         return ret_arr;
15615 }
15616
15617 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
15618         void* this_arg_ptr = untag_ptr(this_arg);
15619         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15620         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15621         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15622         uint64_t ret_ref = 0;
15623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15625         return ret_ref;
15626 }
15627
15628 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15629         void* this_arg_ptr = untag_ptr(this_arg);
15630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15631         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15632         LDKPublicKey their_node_id_ref;
15633         CHECK(their_node_id->arr_len == 33);
15634         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15635         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15636         uint64_t ret_ref = 0;
15637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15639         return ret_ref;
15640 }
15641
15642 typedef struct LDKCustomOnionMessageHandler_JCalls {
15643         atomic_size_t refcnt;
15644         uint32_t instance_ptr;
15645 } LDKCustomOnionMessageHandler_JCalls;
15646 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
15647         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15648         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15649                 FREE(j_calls);
15650         }
15651 }
15652 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
15653         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15654         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
15655         *msg_ret = msg;
15656         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 144, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
15657         void* ret_ptr = untag_ptr(ret);
15658         CHECK_ACCESS(ret_ptr);
15659         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
15660         FREE(untag_ptr(ret));
15661         return ret_conv;
15662 }
15663 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
15664         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15665         int64_t message_type_conv = message_type;
15666         LDKu8slice buffer_var = buffer;
15667         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15668         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15669         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 145, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
15670         void* ret_ptr = untag_ptr(ret);
15671         CHECK_ACCESS(ret_ptr);
15672         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
15673         FREE(untag_ptr(ret));
15674         return ret_conv;
15675 }
15676 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
15677         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15678         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 146, 0, 0, 0, 0, 0, 0);
15679         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
15680         ret_constr.datalen = ret->arr_len;
15681         if (ret_constr.datalen > 0)
15682                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
15683         else
15684                 ret_constr.data = NULL;
15685         uint64_t* ret_vals = ret->elems;
15686         for (size_t e = 0; e < ret_constr.datalen; e++) {
15687                 uint64_t ret_conv_56 = ret_vals[e];
15688                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
15689                 CHECK_ACCESS(ret_conv_56_ptr);
15690                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
15691                 FREE(untag_ptr(ret_conv_56));
15692                 ret_constr.data[e] = ret_conv_56_conv;
15693         }
15694         FREE(ret);
15695         return ret_constr;
15696 }
15697 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
15698         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
15699         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15700 }
15701 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
15702         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
15703         atomic_init(&calls->refcnt, 1);
15704         calls->instance_ptr = o;
15705
15706         LDKCustomOnionMessageHandler ret = {
15707                 .this_arg = (void*) calls,
15708                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
15709                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
15710                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
15711                 .free = LDKCustomOnionMessageHandler_JCalls_free,
15712         };
15713         return ret;
15714 }
15715 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
15716         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
15717         *res_ptr = LDKCustomOnionMessageHandler_init(o);
15718         return tag_ptr(res_ptr, true);
15719 }
15720 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
15721         void* this_arg_ptr = untag_ptr(this_arg);
15722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15723         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15724         void* msg_ptr = untag_ptr(msg);
15725         CHECK_ACCESS(msg_ptr);
15726         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
15727         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
15728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15729                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
15730         }
15731         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
15732         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
15733         uint64_t ret_ref = tag_ptr(ret_copy, true);
15734         return ret_ref;
15735 }
15736
15737 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) {
15738         void* this_arg_ptr = untag_ptr(this_arg);
15739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15740         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15741         LDKu8slice buffer_ref;
15742         buffer_ref.datalen = buffer->arr_len;
15743         buffer_ref.data = buffer->elems;
15744         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
15745         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
15746         FREE(buffer);
15747         return tag_ptr(ret_conv, true);
15748 }
15749
15750 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
15751         void* this_arg_ptr = untag_ptr(this_arg);
15752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15753         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15754         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
15755         uint64_tArray ret_arr = NULL;
15756         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15757         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15758         for (size_t e = 0; e < ret_var.datalen; e++) {
15759                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
15760                 *ret_conv_56_conv = ret_var.data[e];
15761                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
15762         }
15763         
15764         FREE(ret_var.data);
15765         return ret_arr;
15766 }
15767
15768 typedef struct LDKSocketDescriptor_JCalls {
15769         atomic_size_t refcnt;
15770         uint32_t instance_ptr;
15771 } LDKSocketDescriptor_JCalls;
15772 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
15773         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15774         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15775                 FREE(j_calls);
15776         }
15777 }
15778 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
15779         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15780         LDKu8slice data_var = data;
15781         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
15782         memcpy(data_arr->elems, data_var.data, data_var.datalen);
15783         jboolean resume_read_conv = resume_read;
15784         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 147, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
15785 }
15786 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
15787         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15788         js_invoke_function_uuuuuu(j_calls->instance_ptr, 148, 0, 0, 0, 0, 0, 0);
15789 }
15790 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
15791         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15792         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15793         *other_arg_clone = SocketDescriptor_clone(other_arg);
15794         return js_invoke_function_buuuuu(j_calls->instance_ptr, 149, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
15795 }
15796 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
15797         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15798         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 150, 0, 0, 0, 0, 0, 0);
15799 }
15800 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
15801         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
15802         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15803 }
15804 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
15805         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
15806         atomic_init(&calls->refcnt, 1);
15807         calls->instance_ptr = o;
15808
15809         LDKSocketDescriptor ret = {
15810                 .this_arg = (void*) calls,
15811                 .send_data = send_data_LDKSocketDescriptor_jcall,
15812                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
15813                 .eq = eq_LDKSocketDescriptor_jcall,
15814                 .hash = hash_LDKSocketDescriptor_jcall,
15815                 .cloned = LDKSocketDescriptor_JCalls_cloned,
15816                 .free = LDKSocketDescriptor_JCalls_free,
15817         };
15818         return ret;
15819 }
15820 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
15821         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15822         *res_ptr = LDKSocketDescriptor_init(o);
15823         return tag_ptr(res_ptr, true);
15824 }
15825 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
15826         void* this_arg_ptr = untag_ptr(this_arg);
15827         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15828         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15829         LDKu8slice data_ref;
15830         data_ref.datalen = data->arr_len;
15831         data_ref.data = data->elems;
15832         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
15833         FREE(data);
15834         return ret_conv;
15835 }
15836
15837 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
15838         void* this_arg_ptr = untag_ptr(this_arg);
15839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15840         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15841         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
15842 }
15843
15844 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
15845         void* this_arg_ptr = untag_ptr(this_arg);
15846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15847         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15848         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
15849         return ret_conv;
15850 }
15851
15852 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
15853         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15854         switch(obj->tag) {
15855                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
15856                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
15857                 case LDKEffectiveCapacity_Total: return 2;
15858                 case LDKEffectiveCapacity_Infinite: return 3;
15859                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
15860                 case LDKEffectiveCapacity_Unknown: return 5;
15861                 default: abort();
15862         }
15863 }
15864 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
15865         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15866         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
15867         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
15868         return liquidity_msat_conv;
15869 }
15870 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
15871         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15872         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
15873         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
15874         return amount_msat_conv;
15875 }
15876 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
15877         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15878         assert(obj->tag == LDKEffectiveCapacity_Total);
15879         int64_t capacity_msat_conv = obj->total.capacity_msat;
15880         return capacity_msat_conv;
15881 }
15882 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
15883         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15884         assert(obj->tag == LDKEffectiveCapacity_Total);
15885         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
15886         return htlc_maximum_msat_conv;
15887 }
15888 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
15889         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15890         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
15891         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
15892         return amount_msat_conv;
15893 }
15894 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
15895         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15896         switch(obj->tag) {
15897                 case LDKPayee_Blinded: return 0;
15898                 case LDKPayee_Clear: return 1;
15899                 default: abort();
15900         }
15901 }
15902 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
15903         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15904         assert(obj->tag == LDKPayee_Blinded);
15905         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
15906                         uint64_tArray route_hints_arr = NULL;
15907                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
15908                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
15909                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
15910                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
15911                                 *route_hints_conv_37_conv = route_hints_var.data[l];
15912                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
15913                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
15914                         }
15915                         
15916         return route_hints_arr;
15917 }
15918 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
15919         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15920         assert(obj->tag == LDKPayee_Blinded);
15921         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
15922                         uint64_t features_ref = 0;
15923                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
15924                         features_ref = tag_ptr(features_var.inner, false);
15925         return features_ref;
15926 }
15927 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
15928         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15929         assert(obj->tag == LDKPayee_Clear);
15930         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
15931         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
15932         return node_id_arr;
15933 }
15934 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
15935         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15936         assert(obj->tag == LDKPayee_Clear);
15937         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
15938                         uint64_tArray route_hints_arr = NULL;
15939                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
15940                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
15941                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
15942                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
15943                                 uint64_t route_hints_conv_11_ref = 0;
15944                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
15945                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
15946                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
15947                         }
15948                         
15949         return route_hints_arr;
15950 }
15951 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
15952         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15953         assert(obj->tag == LDKPayee_Clear);
15954         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
15955                         uint64_t features_ref = 0;
15956                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
15957                         features_ref = tag_ptr(features_var.inner, false);
15958         return features_ref;
15959 }
15960 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
15961         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15962         assert(obj->tag == LDKPayee_Clear);
15963         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
15964         return final_cltv_expiry_delta_conv;
15965 }
15966 typedef struct LDKScore_JCalls {
15967         atomic_size_t refcnt;
15968         uint32_t instance_ptr;
15969         LDKScoreLookUp_JCalls* ScoreLookUp;
15970         LDKScoreUpdate_JCalls* ScoreUpdate;
15971 } LDKScore_JCalls;
15972 static void LDKScore_JCalls_free(void* this_arg) {
15973         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
15974         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15975                 FREE(j_calls);
15976         }
15977 }
15978 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
15979         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
15980         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 151, 0, 0, 0, 0, 0, 0);
15981         LDKCVec_u8Z ret_ref;
15982         ret_ref.datalen = ret->arr_len;
15983         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
15984         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
15985         return ret_ref;
15986 }
15987 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
15988         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
15989         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15990         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
15991         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
15992 }
15993 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
15994         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
15995         atomic_init(&calls->refcnt, 1);
15996         calls->instance_ptr = o;
15997
15998         LDKScore ret = {
15999                 .this_arg = (void*) calls,
16000                 .write = write_LDKScore_jcall,
16001                 .free = LDKScore_JCalls_free,
16002                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
16003                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
16004         };
16005         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
16006         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
16007         return ret;
16008 }
16009 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
16010         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
16011         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
16012         return tag_ptr(res_ptr, true);
16013 }
16014 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
16015         void* this_arg_ptr = untag_ptr(this_arg);
16016         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16017         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
16018         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
16019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16021         CVec_u8Z_free(ret_var);
16022         return ret_arr;
16023 }
16024
16025 typedef struct LDKCoinSelectionSource_JCalls {
16026         atomic_size_t refcnt;
16027         uint32_t instance_ptr;
16028 } LDKCoinSelectionSource_JCalls;
16029 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
16030         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16031         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16032                 FREE(j_calls);
16033         }
16034 }
16035 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) {
16036         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16037         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
16038         memcpy(claim_id_arr->elems, claim_id.data, 32);
16039         LDKCVec_InputZ must_spend_var = must_spend;
16040         uint64_tArray must_spend_arr = NULL;
16041         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
16042         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
16043         for (size_t h = 0; h < must_spend_var.datalen; h++) {
16044                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
16045                 uint64_t must_spend_conv_7_ref = 0;
16046                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
16047                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
16048                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
16049         }
16050         
16051         FREE(must_spend_var.data);
16052         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
16053         uint64_tArray must_pay_to_arr = NULL;
16054         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
16055         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
16056         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
16057                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16058                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
16059                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
16060         }
16061         
16062         FREE(must_pay_to_var.data);
16063         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
16064         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 152, (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);
16065         void* ret_ptr = untag_ptr(ret);
16066         CHECK_ACCESS(ret_ptr);
16067         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
16068         FREE(untag_ptr(ret));
16069         return ret_conv;
16070 }
16071 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16072         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16073         LDKCVec_u8Z psbt_var = psbt;
16074         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16075         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16076         CVec_u8Z_free(psbt_var);
16077         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 153, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
16078         void* ret_ptr = untag_ptr(ret);
16079         CHECK_ACCESS(ret_ptr);
16080         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16081         FREE(untag_ptr(ret));
16082         return ret_conv;
16083 }
16084 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
16085         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
16086         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16087 }
16088 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
16089         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
16090         atomic_init(&calls->refcnt, 1);
16091         calls->instance_ptr = o;
16092
16093         LDKCoinSelectionSource ret = {
16094                 .this_arg = (void*) calls,
16095                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
16096                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
16097                 .free = LDKCoinSelectionSource_JCalls_free,
16098         };
16099         return ret;
16100 }
16101 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
16102         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
16103         *res_ptr = LDKCoinSelectionSource_init(o);
16104         return tag_ptr(res_ptr, true);
16105 }
16106 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) {
16107         void* this_arg_ptr = untag_ptr(this_arg);
16108         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16109         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16110         LDKThirtyTwoBytes claim_id_ref;
16111         CHECK(claim_id->arr_len == 32);
16112         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
16113         LDKCVec_InputZ must_spend_constr;
16114         must_spend_constr.datalen = must_spend->arr_len;
16115         if (must_spend_constr.datalen > 0)
16116                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
16117         else
16118                 must_spend_constr.data = NULL;
16119         uint64_t* must_spend_vals = must_spend->elems;
16120         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
16121                 uint64_t must_spend_conv_7 = must_spend_vals[h];
16122                 LDKInput must_spend_conv_7_conv;
16123                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
16124                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
16125                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
16126                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
16127                 must_spend_constr.data[h] = must_spend_conv_7_conv;
16128         }
16129         FREE(must_spend);
16130         LDKCVec_TxOutZ must_pay_to_constr;
16131         must_pay_to_constr.datalen = must_pay_to->arr_len;
16132         if (must_pay_to_constr.datalen > 0)
16133                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16134         else
16135                 must_pay_to_constr.data = NULL;
16136         uint64_t* must_pay_to_vals = must_pay_to->elems;
16137         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
16138                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
16139                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
16140                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
16141                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
16142                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
16143                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
16144         }
16145         FREE(must_pay_to);
16146         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
16147         *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);
16148         return tag_ptr(ret_conv, true);
16149 }
16150
16151 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_psbt"))) TS_CoinSelectionSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
16152         void* this_arg_ptr = untag_ptr(this_arg);
16153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16154         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16155         LDKCVec_u8Z psbt_ref;
16156         psbt_ref.datalen = psbt->arr_len;
16157         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16158         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16159         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16160         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16161         return tag_ptr(ret_conv, true);
16162 }
16163
16164 typedef struct LDKWalletSource_JCalls {
16165         atomic_size_t refcnt;
16166         uint32_t instance_ptr;
16167 } LDKWalletSource_JCalls;
16168 static void LDKWalletSource_JCalls_free(void* this_arg) {
16169         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16170         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16171                 FREE(j_calls);
16172         }
16173 }
16174 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
16175         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16176         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 154, 0, 0, 0, 0, 0, 0);
16177         void* ret_ptr = untag_ptr(ret);
16178         CHECK_ACCESS(ret_ptr);
16179         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
16180         FREE(untag_ptr(ret));
16181         return ret_conv;
16182 }
16183 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
16184         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16185         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 155, 0, 0, 0, 0, 0, 0);
16186         void* ret_ptr = untag_ptr(ret);
16187         CHECK_ACCESS(ret_ptr);
16188         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
16189         FREE(untag_ptr(ret));
16190         return ret_conv;
16191 }
16192 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16193         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16194         LDKCVec_u8Z psbt_var = psbt;
16195         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16196         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16197         CVec_u8Z_free(psbt_var);
16198         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 156, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
16199         void* ret_ptr = untag_ptr(ret);
16200         CHECK_ACCESS(ret_ptr);
16201         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16202         FREE(untag_ptr(ret));
16203         return ret_conv;
16204 }
16205 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
16206         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
16207         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16208 }
16209 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
16210         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
16211         atomic_init(&calls->refcnt, 1);
16212         calls->instance_ptr = o;
16213
16214         LDKWalletSource ret = {
16215                 .this_arg = (void*) calls,
16216                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
16217                 .get_change_script = get_change_script_LDKWalletSource_jcall,
16218                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
16219                 .free = LDKWalletSource_JCalls_free,
16220         };
16221         return ret;
16222 }
16223 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
16224         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
16225         *res_ptr = LDKWalletSource_init(o);
16226         return tag_ptr(res_ptr, true);
16227 }
16228 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
16229         void* this_arg_ptr = untag_ptr(this_arg);
16230         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16231         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16232         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
16233         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
16234         return tag_ptr(ret_conv, true);
16235 }
16236
16237 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
16238         void* this_arg_ptr = untag_ptr(this_arg);
16239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16240         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16241         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16242         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
16243         return tag_ptr(ret_conv, true);
16244 }
16245
16246 uint64_t  __attribute__((export_name("TS_WalletSource_sign_psbt"))) TS_WalletSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
16247         void* this_arg_ptr = untag_ptr(this_arg);
16248         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16249         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16250         LDKCVec_u8Z psbt_ref;
16251         psbt_ref.datalen = psbt->arr_len;
16252         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16253         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16254         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16255         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16256         return tag_ptr(ret_conv, true);
16257 }
16258
16259 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
16260         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16261         switch(obj->tag) {
16262                 case LDKGossipSync_P2P: return 0;
16263                 case LDKGossipSync_Rapid: return 1;
16264                 case LDKGossipSync_None: return 2;
16265                 default: abort();
16266         }
16267 }
16268 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
16269         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16270         assert(obj->tag == LDKGossipSync_P2P);
16271         LDKP2PGossipSync p2p_var = obj->p2p;
16272                         uint64_t p2p_ref = 0;
16273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
16274                         p2p_ref = tag_ptr(p2p_var.inner, false);
16275         return p2p_ref;
16276 }
16277 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
16278         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16279         assert(obj->tag == LDKGossipSync_Rapid);
16280         LDKRapidGossipSync rapid_var = obj->rapid;
16281                         uint64_t rapid_ref = 0;
16282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
16283                         rapid_ref = tag_ptr(rapid_var.inner, false);
16284         return rapid_ref;
16285 }
16286 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
16287         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16288         switch(obj->tag) {
16289                 case LDKFallback_SegWitProgram: return 0;
16290                 case LDKFallback_PubKeyHash: return 1;
16291                 case LDKFallback_ScriptHash: return 2;
16292                 default: abort();
16293         }
16294 }
16295 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
16296         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16297         assert(obj->tag == LDKFallback_SegWitProgram);
16298         uint8_t version_val = obj->seg_wit_program.version._0;
16299         return version_val;
16300 }
16301 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
16302         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16303         assert(obj->tag == LDKFallback_SegWitProgram);
16304         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
16305                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
16306                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
16307         return program_arr;
16308 }
16309 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
16310         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16311         assert(obj->tag == LDKFallback_PubKeyHash);
16312         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
16313         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
16314         return pub_key_hash_arr;
16315 }
16316 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
16317         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16318         assert(obj->tag == LDKFallback_ScriptHash);
16319         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
16320         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
16321         return script_hash_arr;
16322 }
16323 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
16324         LDKStr ret_str = _ldk_get_compiled_version();
16325         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16326         Str_free(ret_str);
16327         return ret_conv;
16328 }
16329
16330 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
16331         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
16332         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16333         Str_free(ret_str);
16334         return ret_conv;
16335 }
16336
16337 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
16338         LDKU128 val_ref;
16339         CHECK(val->arr_len == 16);
16340         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
16341         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16342         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
16343         return ret_arr;
16344 }
16345
16346 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
16347         LDKSixteenBytes le_bytes_ref;
16348         CHECK(le_bytes->arr_len == 16);
16349         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
16350         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16351         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
16352         return ret_arr;
16353 }
16354
16355 uint64_t  __attribute__((export_name("TS_WitnessProgram_new"))) TS_WitnessProgram_new(int8_t version, int8_tArray program) {
16356         
16357         LDKCVec_u8Z program_ref;
16358         program_ref.datalen = program->arr_len;
16359         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
16360         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
16361         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16362         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
16363         return tag_ptr(ret_ref, true);
16364 }
16365
16366 int8_t  __attribute__((export_name("TS_WitnessProgram_get_version"))) TS_WitnessProgram_get_version(uint64_t prog) {
16367         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16368         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
16369         return ret_val;
16370 }
16371
16372 int8_tArray  __attribute__((export_name("TS_WitnessProgram_get_program"))) TS_WitnessProgram_get_program(uint64_t prog) {
16373         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16374         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
16375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16377         return ret_arr;
16378 }
16379
16380 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
16381         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16382         *ret_ref = WitnessProgram_clone(arg);
16383         return tag_ptr(ret_ref, true);
16384 }
16385 int64_t  __attribute__((export_name("TS_WitnessProgram_clone_ptr"))) TS_WitnessProgram_clone_ptr(uint64_t arg) {
16386         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
16387         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
16388         return ret_conv;
16389 }
16390
16391 uint64_t  __attribute__((export_name("TS_WitnessProgram_clone"))) TS_WitnessProgram_clone(uint64_t orig) {
16392         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
16393         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16394         *ret_ref = WitnessProgram_clone(orig_conv);
16395         return tag_ptr(ret_ref, true);
16396 }
16397
16398 void  __attribute__((export_name("TS_WitnessProgram_free"))) TS_WitnessProgram_free(uint64_t o) {
16399         if (!ptr_is_owned(o)) return;
16400         void* o_ptr = untag_ptr(o);
16401         CHECK_ACCESS(o_ptr);
16402         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
16403         FREE(untag_ptr(o));
16404         WitnessProgram_free(o_conv);
16405 }
16406
16407 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
16408         LDKThirtyTwoBytes big_endian_bytes_ref;
16409         CHECK(big_endian_bytes->arr_len == 32);
16410         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
16411         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
16412         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
16413         return tag_ptr(ret_ref, true);
16414 }
16415
16416 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
16417         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16418         *ret_copy = Bech32Error_clone(arg);
16419         uint64_t ret_ref = tag_ptr(ret_copy, true);
16420         return ret_ref;
16421 }
16422 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
16423         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
16424         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
16425         return ret_conv;
16426 }
16427
16428 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
16429         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
16430         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16431         *ret_copy = Bech32Error_clone(orig_conv);
16432         uint64_t ret_ref = tag_ptr(ret_copy, true);
16433         return ret_ref;
16434 }
16435
16436 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
16437         if (!ptr_is_owned(o)) return;
16438         void* o_ptr = untag_ptr(o);
16439         CHECK_ACCESS(o_ptr);
16440         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
16441         FREE(untag_ptr(o));
16442         Bech32Error_free(o_conv);
16443 }
16444
16445 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
16446         LDKTransaction _res_ref;
16447         _res_ref.datalen = _res->arr_len;
16448         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
16449         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16450         _res_ref.data_is_owned = true;
16451         Transaction_free(_res_ref);
16452 }
16453
16454 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
16455         LDKWitness _res_ref;
16456         _res_ref.datalen = _res->arr_len;
16457         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
16458         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16459         _res_ref.data_is_owned = true;
16460         Witness_free(_res_ref);
16461 }
16462
16463 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) {
16464         LDKWitness witness_ref;
16465         witness_ref.datalen = witness->arr_len;
16466         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
16467         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
16468         witness_ref.data_is_owned = true;
16469         LDKCVec_u8Z script_sig_ref;
16470         script_sig_ref.datalen = script_sig->arr_len;
16471         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
16472         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
16473         LDKThirtyTwoBytes previous_txid_ref;
16474         CHECK(previous_txid->arr_len == 32);
16475         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
16476         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
16477         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
16478         return tag_ptr(ret_ref, true);
16479 }
16480
16481 int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t txin) {
16482         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16483         LDKWitness ret_var = TxIn_get_witness(txin_conv);
16484         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16485         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16486         Witness_free(ret_var);
16487         return ret_arr;
16488 }
16489
16490 int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t txin) {
16491         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16492         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
16493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16495         return ret_arr;
16496 }
16497
16498 int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t txin) {
16499         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16500         int32_t ret_conv = TxIn_get_sequence(txin_conv);
16501         return ret_conv;
16502 }
16503
16504 int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t txin) {
16505         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16506         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
16507         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
16508         return ret_arr;
16509 }
16510
16511 int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t txin) {
16512         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16513         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
16514         return ret_conv;
16515 }
16516
16517 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
16518         if (!ptr_is_owned(_res)) return;
16519         void* _res_ptr = untag_ptr(_res);
16520         CHECK_ACCESS(_res_ptr);
16521         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
16522         FREE(untag_ptr(_res));
16523         TxIn_free(_res_conv);
16524 }
16525
16526 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
16527         LDKCVec_u8Z script_pubkey_ref;
16528         script_pubkey_ref.datalen = script_pubkey->arr_len;
16529         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
16530         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
16531         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16532         *ret_ref = TxOut_new(script_pubkey_ref, value);
16533         return tag_ptr(ret_ref, true);
16534 }
16535
16536 int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t txout) {
16537         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16538         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
16539         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16540         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16541         return ret_arr;
16542 }
16543
16544 int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t txout) {
16545         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16546         int64_t ret_conv = TxOut_get_value(txout_conv);
16547         return ret_conv;
16548 }
16549
16550 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
16551         if (!ptr_is_owned(_res)) return;
16552         void* _res_ptr = untag_ptr(_res);
16553         CHECK_ACCESS(_res_ptr);
16554         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
16555         FREE(untag_ptr(_res));
16556         TxOut_free(_res_conv);
16557 }
16558
16559 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
16560         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16561         *ret_ref = TxOut_clone(arg);
16562         return tag_ptr(ret_ref, true);
16563 }
16564 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
16565         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
16566         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
16567         return ret_conv;
16568 }
16569
16570 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
16571         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
16572         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16573         *ret_ref = TxOut_clone(orig_conv);
16574         return tag_ptr(ret_ref, true);
16575 }
16576
16577 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
16578         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
16579         Str_free(dummy);
16580 }
16581
16582 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
16583         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16584         *ret_copy = COption_u64Z_some(o);
16585         uint64_t ret_ref = tag_ptr(ret_copy, true);
16586         return ret_ref;
16587 }
16588
16589 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
16590         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16591         *ret_copy = COption_u64Z_none();
16592         uint64_t ret_ref = tag_ptr(ret_copy, true);
16593         return ret_ref;
16594 }
16595
16596 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
16597         if (!ptr_is_owned(_res)) return;
16598         void* _res_ptr = untag_ptr(_res);
16599         CHECK_ACCESS(_res_ptr);
16600         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16601         FREE(untag_ptr(_res));
16602         COption_u64Z_free(_res_conv);
16603 }
16604
16605 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16606         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16607         *ret_copy = COption_u64Z_clone(arg);
16608         uint64_t ret_ref = tag_ptr(ret_copy, true);
16609         return ret_ref;
16610 }
16611 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
16612         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
16613         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16614         return ret_conv;
16615 }
16616
16617 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
16618         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
16619         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16620         *ret_copy = COption_u64Z_clone(orig_conv);
16621         uint64_t ret_ref = tag_ptr(ret_copy, true);
16622         return ret_ref;
16623 }
16624
16625 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
16626         LDKCVec_BlindedPathZ _res_constr;
16627         _res_constr.datalen = _res->arr_len;
16628         if (_res_constr.datalen > 0)
16629                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
16630         else
16631                 _res_constr.data = NULL;
16632         uint64_t* _res_vals = _res->elems;
16633         for (size_t n = 0; n < _res_constr.datalen; n++) {
16634                 uint64_t _res_conv_13 = _res_vals[n];
16635                 LDKBlindedPath _res_conv_13_conv;
16636                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
16637                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
16638                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
16639                 _res_constr.data[n] = _res_conv_13_conv;
16640         }
16641         FREE(_res);
16642         CVec_BlindedPathZ_free(_res_constr);
16643 }
16644
16645 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
16646         LDKRefund o_conv;
16647         o_conv.inner = untag_ptr(o);
16648         o_conv.is_owned = ptr_is_owned(o);
16649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16650         o_conv = Refund_clone(&o_conv);
16651         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16652         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
16653         return tag_ptr(ret_conv, true);
16654 }
16655
16656 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
16657         LDKBolt12ParseError e_conv;
16658         e_conv.inner = untag_ptr(e);
16659         e_conv.is_owned = ptr_is_owned(e);
16660         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16661         e_conv = Bolt12ParseError_clone(&e_conv);
16662         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16663         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
16664         return tag_ptr(ret_conv, true);
16665 }
16666
16667 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
16668         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
16669         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
16670         return ret_conv;
16671 }
16672
16673 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
16674         if (!ptr_is_owned(_res)) return;
16675         void* _res_ptr = untag_ptr(_res);
16676         CHECK_ACCESS(_res_ptr);
16677         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
16678         FREE(untag_ptr(_res));
16679         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
16680 }
16681
16682 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
16683         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16684         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
16685         return tag_ptr(ret_conv, true);
16686 }
16687 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
16688         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
16689         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
16690         return ret_conv;
16691 }
16692
16693 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
16694         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
16695         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16696         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
16697         return tag_ptr(ret_conv, true);
16698 }
16699
16700 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
16701         void* o_ptr = untag_ptr(o);
16702         CHECK_ACCESS(o_ptr);
16703         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
16704         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
16705         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16706         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
16707         return tag_ptr(ret_conv, true);
16708 }
16709
16710 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
16711         void* e_ptr = untag_ptr(e);
16712         CHECK_ACCESS(e_ptr);
16713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16715         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16716         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
16717         return tag_ptr(ret_conv, true);
16718 }
16719
16720 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
16721         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
16722         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
16723         return ret_conv;
16724 }
16725
16726 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
16727         if (!ptr_is_owned(_res)) return;
16728         void* _res_ptr = untag_ptr(_res);
16729         CHECK_ACCESS(_res_ptr);
16730         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
16731         FREE(untag_ptr(_res));
16732         CResult_RetryDecodeErrorZ_free(_res_conv);
16733 }
16734
16735 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
16736         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16737         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
16738         return tag_ptr(ret_conv, true);
16739 }
16740 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
16741         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
16742         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
16743         return ret_conv;
16744 }
16745
16746 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
16747         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
16748         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16749         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
16750         return tag_ptr(ret_conv, true);
16751 }
16752
16753 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
16754         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16755         *ret_conv = CResult_NoneAPIErrorZ_ok();
16756         return tag_ptr(ret_conv, true);
16757 }
16758
16759 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
16760         void* e_ptr = untag_ptr(e);
16761         CHECK_ACCESS(e_ptr);
16762         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16763         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16764         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16765         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
16766         return tag_ptr(ret_conv, true);
16767 }
16768
16769 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
16770         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
16771         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
16772         return ret_conv;
16773 }
16774
16775 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_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_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
16780         FREE(untag_ptr(_res));
16781         CResult_NoneAPIErrorZ_free(_res_conv);
16782 }
16783
16784 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
16785         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16786         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
16787         return tag_ptr(ret_conv, true);
16788 }
16789 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
16790         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
16791         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
16792         return ret_conv;
16793 }
16794
16795 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
16796         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
16797         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16798         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
16799         return tag_ptr(ret_conv, true);
16800 }
16801
16802 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
16803         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
16804         _res_constr.datalen = _res->arr_len;
16805         if (_res_constr.datalen > 0)
16806                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16807         else
16808                 _res_constr.data = NULL;
16809         uint64_t* _res_vals = _res->elems;
16810         for (size_t w = 0; w < _res_constr.datalen; w++) {
16811                 uint64_t _res_conv_22 = _res_vals[w];
16812                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
16813                 CHECK_ACCESS(_res_conv_22_ptr);
16814                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
16815                 FREE(untag_ptr(_res_conv_22));
16816                 _res_constr.data[w] = _res_conv_22_conv;
16817         }
16818         FREE(_res);
16819         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
16820 }
16821
16822 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
16823         LDKCVec_APIErrorZ _res_constr;
16824         _res_constr.datalen = _res->arr_len;
16825         if (_res_constr.datalen > 0)
16826                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16827         else
16828                 _res_constr.data = NULL;
16829         uint64_t* _res_vals = _res->elems;
16830         for (size_t k = 0; k < _res_constr.datalen; k++) {
16831                 uint64_t _res_conv_10 = _res_vals[k];
16832                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
16833                 CHECK_ACCESS(_res_conv_10_ptr);
16834                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
16835                 FREE(untag_ptr(_res_conv_10));
16836                 _res_constr.data[k] = _res_conv_10_conv;
16837         }
16838         FREE(_res);
16839         CVec_APIErrorZ_free(_res_constr);
16840 }
16841
16842 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
16843         LDKThirtyTwoBytes o_ref;
16844         CHECK(o->arr_len == 32);
16845         memcpy(o_ref.data, o->elems, 32); FREE(o);
16846         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16847         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
16848         uint64_t ret_ref = tag_ptr(ret_copy, true);
16849         return ret_ref;
16850 }
16851
16852 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
16853         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16854         *ret_copy = COption_ThirtyTwoBytesZ_none();
16855         uint64_t ret_ref = tag_ptr(ret_copy, true);
16856         return ret_ref;
16857 }
16858
16859 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
16860         if (!ptr_is_owned(_res)) return;
16861         void* _res_ptr = untag_ptr(_res);
16862         CHECK_ACCESS(_res_ptr);
16863         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
16864         FREE(untag_ptr(_res));
16865         COption_ThirtyTwoBytesZ_free(_res_conv);
16866 }
16867
16868 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
16869         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16870         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
16871         uint64_t ret_ref = tag_ptr(ret_copy, true);
16872         return ret_ref;
16873 }
16874 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
16875         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
16876         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
16877         return ret_conv;
16878 }
16879
16880 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
16881         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
16882         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16883         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
16884         uint64_t ret_ref = tag_ptr(ret_copy, true);
16885         return ret_ref;
16886 }
16887
16888 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
16889         LDKCVec_u8Z _res_ref;
16890         _res_ref.datalen = _res->arr_len;
16891         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16892         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16893         CVec_u8Z_free(_res_ref);
16894 }
16895
16896 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
16897         LDKCVec_u8Z o_ref;
16898         o_ref.datalen = o->arr_len;
16899         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16900         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16901         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16902         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
16903         uint64_t ret_ref = tag_ptr(ret_copy, true);
16904         return ret_ref;
16905 }
16906
16907 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
16908         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16909         *ret_copy = COption_CVec_u8ZZ_none();
16910         uint64_t ret_ref = tag_ptr(ret_copy, true);
16911         return ret_ref;
16912 }
16913
16914 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
16915         if (!ptr_is_owned(_res)) return;
16916         void* _res_ptr = untag_ptr(_res);
16917         CHECK_ACCESS(_res_ptr);
16918         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
16919         FREE(untag_ptr(_res));
16920         COption_CVec_u8ZZ_free(_res_conv);
16921 }
16922
16923 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
16924         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16925         *ret_copy = COption_CVec_u8ZZ_clone(arg);
16926         uint64_t ret_ref = tag_ptr(ret_copy, true);
16927         return ret_ref;
16928 }
16929 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
16930         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
16931         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
16932         return ret_conv;
16933 }
16934
16935 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
16936         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
16937         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16938         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
16939         uint64_t ret_ref = tag_ptr(ret_copy, true);
16940         return ret_ref;
16941 }
16942
16943 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
16944         LDKRecipientOnionFields o_conv;
16945         o_conv.inner = untag_ptr(o);
16946         o_conv.is_owned = ptr_is_owned(o);
16947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16948         o_conv = RecipientOnionFields_clone(&o_conv);
16949         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16950         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
16951         return tag_ptr(ret_conv, true);
16952 }
16953
16954 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
16955         void* e_ptr = untag_ptr(e);
16956         CHECK_ACCESS(e_ptr);
16957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16959         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16960         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
16961         return tag_ptr(ret_conv, true);
16962 }
16963
16964 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
16965         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
16966         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
16967         return ret_conv;
16968 }
16969
16970 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
16971         if (!ptr_is_owned(_res)) return;
16972         void* _res_ptr = untag_ptr(_res);
16973         CHECK_ACCESS(_res_ptr);
16974         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
16975         FREE(untag_ptr(_res));
16976         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
16977 }
16978
16979 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
16980         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16981         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
16982         return tag_ptr(ret_conv, true);
16983 }
16984 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
16985         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
16986         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
16987         return ret_conv;
16988 }
16989
16990 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
16991         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
16992         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16993         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
16994         return tag_ptr(ret_conv, true);
16995 }
16996
16997 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
16998         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
16999         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
17000         return tag_ptr(ret_conv, true);
17001 }
17002 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
17003         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
17004         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
17005         return ret_conv;
17006 }
17007
17008 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
17009         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
17010         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17011         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
17012         return tag_ptr(ret_conv, true);
17013 }
17014
17015 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
17016         LDKCVec_u8Z b_ref;
17017         b_ref.datalen = b->arr_len;
17018         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17019         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17020         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17021         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
17022         return tag_ptr(ret_conv, true);
17023 }
17024
17025 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
17026         if (!ptr_is_owned(_res)) return;
17027         void* _res_ptr = untag_ptr(_res);
17028         CHECK_ACCESS(_res_ptr);
17029         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
17030         FREE(untag_ptr(_res));
17031         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
17032 }
17033
17034 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
17035         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
17036         _res_constr.datalen = _res->arr_len;
17037         if (_res_constr.datalen > 0)
17038                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
17039         else
17040                 _res_constr.data = NULL;
17041         uint64_t* _res_vals = _res->elems;
17042         for (size_t x = 0; x < _res_constr.datalen; x++) {
17043                 uint64_t _res_conv_23 = _res_vals[x];
17044                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
17045                 CHECK_ACCESS(_res_conv_23_ptr);
17046                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
17047                 FREE(untag_ptr(_res_conv_23));
17048                 _res_constr.data[x] = _res_conv_23_conv;
17049         }
17050         FREE(_res);
17051         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
17052 }
17053
17054 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
17055         LDKRecipientOnionFields o_conv;
17056         o_conv.inner = untag_ptr(o);
17057         o_conv.is_owned = ptr_is_owned(o);
17058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17059         o_conv = RecipientOnionFields_clone(&o_conv);
17060         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17061         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
17062         return tag_ptr(ret_conv, true);
17063 }
17064
17065 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
17066         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17067         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
17068         return tag_ptr(ret_conv, true);
17069 }
17070
17071 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
17072         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
17073         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
17074         return ret_conv;
17075 }
17076
17077 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
17078         if (!ptr_is_owned(_res)) return;
17079         void* _res_ptr = untag_ptr(_res);
17080         CHECK_ACCESS(_res_ptr);
17081         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
17082         FREE(untag_ptr(_res));
17083         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
17084 }
17085
17086 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
17087         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17088         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
17089         return tag_ptr(ret_conv, true);
17090 }
17091 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
17092         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
17093         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
17094         return ret_conv;
17095 }
17096
17097 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
17098         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
17099         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17100         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
17101         return tag_ptr(ret_conv, true);
17102 }
17103
17104 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17105         LDKCVec_ThirtyTwoBytesZ _res_constr;
17106         _res_constr.datalen = _res->arr_len;
17107         if (_res_constr.datalen > 0)
17108                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17109         else
17110                 _res_constr.data = NULL;
17111         int8_tArray* _res_vals = (void*) _res->elems;
17112         for (size_t m = 0; m < _res_constr.datalen; m++) {
17113                 int8_tArray _res_conv_12 = _res_vals[m];
17114                 LDKThirtyTwoBytes _res_conv_12_ref;
17115                 CHECK(_res_conv_12->arr_len == 32);
17116                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
17117                 _res_constr.data[m] = _res_conv_12_ref;
17118         }
17119         FREE(_res);
17120         CVec_ThirtyTwoBytesZ_free(_res_constr);
17121 }
17122
17123 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
17124         LDKCVec_ThirtyTwoBytesZ o_constr;
17125         o_constr.datalen = o->arr_len;
17126         if (o_constr.datalen > 0)
17127                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17128         else
17129                 o_constr.data = NULL;
17130         int8_tArray* o_vals = (void*) o->elems;
17131         for (size_t m = 0; m < o_constr.datalen; m++) {
17132                 int8_tArray o_conv_12 = o_vals[m];
17133                 LDKThirtyTwoBytes o_conv_12_ref;
17134                 CHECK(o_conv_12->arr_len == 32);
17135                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
17136                 o_constr.data[m] = o_conv_12_ref;
17137         }
17138         FREE(o);
17139         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17140         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
17141         uint64_t ret_ref = tag_ptr(ret_copy, true);
17142         return ret_ref;
17143 }
17144
17145 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
17146         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17147         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
17148         uint64_t ret_ref = tag_ptr(ret_copy, true);
17149         return ret_ref;
17150 }
17151
17152 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
17153         if (!ptr_is_owned(_res)) return;
17154         void* _res_ptr = untag_ptr(_res);
17155         CHECK_ACCESS(_res_ptr);
17156         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
17157         FREE(untag_ptr(_res));
17158         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
17159 }
17160
17161 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
17162         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17163         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
17164         uint64_t ret_ref = tag_ptr(ret_copy, true);
17165         return ret_ref;
17166 }
17167 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
17168         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
17169         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
17170         return ret_conv;
17171 }
17172
17173 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
17174         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
17175         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17176         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
17177         uint64_t ret_ref = tag_ptr(ret_copy, true);
17178         return ret_ref;
17179 }
17180
17181 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
17182         LDKThirtyTwoBytes o_ref;
17183         CHECK(o->arr_len == 32);
17184         memcpy(o_ref.data, o->elems, 32); FREE(o);
17185         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17186         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
17187         return tag_ptr(ret_conv, true);
17188 }
17189
17190 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
17191         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17192         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
17193         return tag_ptr(ret_conv, true);
17194 }
17195
17196 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
17197         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
17198         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
17199         return ret_conv;
17200 }
17201
17202 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
17203         if (!ptr_is_owned(_res)) return;
17204         void* _res_ptr = untag_ptr(_res);
17205         CHECK_ACCESS(_res_ptr);
17206         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
17207         FREE(untag_ptr(_res));
17208         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
17209 }
17210
17211 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
17212         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17213         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
17214         return tag_ptr(ret_conv, true);
17215 }
17216 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
17217         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
17218         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
17219         return ret_conv;
17220 }
17221
17222 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
17223         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
17224         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17225         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
17226         return tag_ptr(ret_conv, true);
17227 }
17228
17229 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
17230         LDKBlindedPayInfo o_conv;
17231         o_conv.inner = untag_ptr(o);
17232         o_conv.is_owned = ptr_is_owned(o);
17233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17234         o_conv = BlindedPayInfo_clone(&o_conv);
17235         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17236         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
17237         return tag_ptr(ret_conv, true);
17238 }
17239
17240 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
17241         void* e_ptr = untag_ptr(e);
17242         CHECK_ACCESS(e_ptr);
17243         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17244         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17245         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17246         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
17247         return tag_ptr(ret_conv, true);
17248 }
17249
17250 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
17251         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
17252         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
17253         return ret_conv;
17254 }
17255
17256 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
17257         if (!ptr_is_owned(_res)) return;
17258         void* _res_ptr = untag_ptr(_res);
17259         CHECK_ACCESS(_res_ptr);
17260         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
17261         FREE(untag_ptr(_res));
17262         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
17263 }
17264
17265 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
17266         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17267         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
17268         return tag_ptr(ret_conv, true);
17269 }
17270 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17271         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
17272         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
17273         return ret_conv;
17274 }
17275
17276 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
17277         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
17278         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17279         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
17280         return tag_ptr(ret_conv, true);
17281 }
17282
17283 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
17284         LDKDelayedPaymentOutputDescriptor o_conv;
17285         o_conv.inner = untag_ptr(o);
17286         o_conv.is_owned = ptr_is_owned(o);
17287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17288         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17289         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17290         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17291         return tag_ptr(ret_conv, true);
17292 }
17293
17294 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
17295         void* e_ptr = untag_ptr(e);
17296         CHECK_ACCESS(e_ptr);
17297         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17298         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17299         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17300         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17301         return tag_ptr(ret_conv, true);
17302 }
17303
17304 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17305         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17306         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17307         return ret_conv;
17308 }
17309
17310 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
17311         if (!ptr_is_owned(_res)) return;
17312         void* _res_ptr = untag_ptr(_res);
17313         CHECK_ACCESS(_res_ptr);
17314         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17315         FREE(untag_ptr(_res));
17316         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17317 }
17318
17319 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17320         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17321         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17322         return tag_ptr(ret_conv, true);
17323 }
17324 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17325         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17326         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17327         return ret_conv;
17328 }
17329
17330 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
17331         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17332         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17333         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17334         return tag_ptr(ret_conv, true);
17335 }
17336
17337 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
17338         LDKStaticPaymentOutputDescriptor o_conv;
17339         o_conv.inner = untag_ptr(o);
17340         o_conv.is_owned = ptr_is_owned(o);
17341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17342         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17343         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17344         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17345         return tag_ptr(ret_conv, true);
17346 }
17347
17348 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
17349         void* e_ptr = untag_ptr(e);
17350         CHECK_ACCESS(e_ptr);
17351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17353         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17354         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17355         return tag_ptr(ret_conv, true);
17356 }
17357
17358 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17359         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17360         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17361         return ret_conv;
17362 }
17363
17364 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
17365         if (!ptr_is_owned(_res)) return;
17366         void* _res_ptr = untag_ptr(_res);
17367         CHECK_ACCESS(_res_ptr);
17368         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17369         FREE(untag_ptr(_res));
17370         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17371 }
17372
17373 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17374         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17375         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17376         return tag_ptr(ret_conv, true);
17377 }
17378 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17379         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17380         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17381         return ret_conv;
17382 }
17383
17384 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
17385         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17386         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17387         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17388         return tag_ptr(ret_conv, true);
17389 }
17390
17391 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
17392         void* o_ptr = untag_ptr(o);
17393         CHECK_ACCESS(o_ptr);
17394         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17395         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17396         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17397         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17398         return tag_ptr(ret_conv, true);
17399 }
17400
17401 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
17402         void* e_ptr = untag_ptr(e);
17403         CHECK_ACCESS(e_ptr);
17404         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17405         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17406         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17407         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17408         return tag_ptr(ret_conv, true);
17409 }
17410
17411 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17412         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17413         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17414         return ret_conv;
17415 }
17416
17417 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
17418         if (!ptr_is_owned(_res)) return;
17419         void* _res_ptr = untag_ptr(_res);
17420         CHECK_ACCESS(_res_ptr);
17421         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17422         FREE(untag_ptr(_res));
17423         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17424 }
17425
17426 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17427         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17428         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17429         return tag_ptr(ret_conv, true);
17430 }
17431 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17432         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17433         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17434         return ret_conv;
17435 }
17436
17437 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
17438         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17439         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17440         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17441         return tag_ptr(ret_conv, true);
17442 }
17443
17444 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
17445         LDKCVec_SpendableOutputDescriptorZ _res_constr;
17446         _res_constr.datalen = _res->arr_len;
17447         if (_res_constr.datalen > 0)
17448                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17449         else
17450                 _res_constr.data = NULL;
17451         uint64_t* _res_vals = _res->elems;
17452         for (size_t b = 0; b < _res_constr.datalen; b++) {
17453                 uint64_t _res_conv_27 = _res_vals[b];
17454                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
17455                 CHECK_ACCESS(_res_conv_27_ptr);
17456                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
17457                 FREE(untag_ptr(_res_conv_27));
17458                 _res_constr.data[b] = _res_conv_27_conv;
17459         }
17460         FREE(_res);
17461         CVec_SpendableOutputDescriptorZ_free(_res_constr);
17462 }
17463
17464 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
17465         LDKCVec_TxOutZ _res_constr;
17466         _res_constr.datalen = _res->arr_len;
17467         if (_res_constr.datalen > 0)
17468                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17469         else
17470                 _res_constr.data = NULL;
17471         uint64_t* _res_vals = _res->elems;
17472         for (size_t h = 0; h < _res_constr.datalen; h++) {
17473                 uint64_t _res_conv_7 = _res_vals[h];
17474                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17475                 CHECK_ACCESS(_res_conv_7_ptr);
17476                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17477                 FREE(untag_ptr(_res_conv_7));
17478                 _res_constr.data[h] = _res_conv_7_conv;
17479         }
17480         FREE(_res);
17481         CVec_TxOutZ_free(_res_constr);
17482 }
17483
17484 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
17485         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17486         *ret_copy = COption_u32Z_some(o);
17487         uint64_t ret_ref = tag_ptr(ret_copy, true);
17488         return ret_ref;
17489 }
17490
17491 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
17492         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17493         *ret_copy = COption_u32Z_none();
17494         uint64_t ret_ref = tag_ptr(ret_copy, true);
17495         return ret_ref;
17496 }
17497
17498 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
17499         if (!ptr_is_owned(_res)) return;
17500         void* _res_ptr = untag_ptr(_res);
17501         CHECK_ACCESS(_res_ptr);
17502         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
17503         FREE(untag_ptr(_res));
17504         COption_u32Z_free(_res_conv);
17505 }
17506
17507 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
17508         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17509         *ret_copy = COption_u32Z_clone(arg);
17510         uint64_t ret_ref = tag_ptr(ret_copy, true);
17511         return ret_ref;
17512 }
17513 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
17514         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
17515         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
17516         return ret_conv;
17517 }
17518
17519 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
17520         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
17521         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17522         *ret_copy = COption_u32Z_clone(orig_conv);
17523         uint64_t ret_ref = tag_ptr(ret_copy, true);
17524         return ret_ref;
17525 }
17526
17527 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
17528         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17529         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
17530         return tag_ptr(ret_conv, true);
17531 }
17532 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone_ptr"))) TS_C2Tuple_CVec_u8Zu64Z_clone_ptr(uint64_t arg) {
17533         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
17534         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
17535         return ret_conv;
17536 }
17537
17538 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone"))) TS_C2Tuple_CVec_u8Zu64Z_clone(uint64_t orig) {
17539         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
17540         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17541         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
17542         return tag_ptr(ret_conv, true);
17543 }
17544
17545 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_new"))) TS_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
17546         LDKCVec_u8Z a_ref;
17547         a_ref.datalen = a->arr_len;
17548         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
17549         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
17550         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17551         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
17552         return tag_ptr(ret_conv, true);
17553 }
17554
17555 void  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_free"))) TS_C2Tuple_CVec_u8Zu64Z_free(uint64_t _res) {
17556         if (!ptr_is_owned(_res)) return;
17557         void* _res_ptr = untag_ptr(_res);
17558         CHECK_ACCESS(_res_ptr);
17559         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
17560         FREE(untag_ptr(_res));
17561         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
17562 }
17563
17564 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(uint64_t o) {
17565         void* o_ptr = untag_ptr(o);
17566         CHECK_ACCESS(o_ptr);
17567         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
17568         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
17569         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17570         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
17571         return tag_ptr(ret_conv, true);
17572 }
17573
17574 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
17575         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17576         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
17577         return tag_ptr(ret_conv, true);
17578 }
17579
17580 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(uint64_t o) {
17581         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
17582         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
17583         return ret_conv;
17584 }
17585
17586 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(uint64_t _res) {
17587         if (!ptr_is_owned(_res)) return;
17588         void* _res_ptr = untag_ptr(_res);
17589         CHECK_ACCESS(_res_ptr);
17590         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
17591         FREE(untag_ptr(_res));
17592         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
17593 }
17594
17595 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
17596         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17597         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
17598         return tag_ptr(ret_conv, true);
17599 }
17600 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(uint64_t arg) {
17601         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
17602         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
17603         return ret_conv;
17604 }
17605
17606 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(uint64_t orig) {
17607         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
17608         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17609         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
17610         return tag_ptr(ret_conv, true);
17611 }
17612
17613 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
17614         LDKChannelDerivationParameters o_conv;
17615         o_conv.inner = untag_ptr(o);
17616         o_conv.is_owned = ptr_is_owned(o);
17617         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17618         o_conv = ChannelDerivationParameters_clone(&o_conv);
17619         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17620         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
17621         return tag_ptr(ret_conv, true);
17622 }
17623
17624 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
17625         void* e_ptr = untag_ptr(e);
17626         CHECK_ACCESS(e_ptr);
17627         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17628         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17629         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17630         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
17631         return tag_ptr(ret_conv, true);
17632 }
17633
17634 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
17635         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
17636         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
17637         return ret_conv;
17638 }
17639
17640 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
17641         if (!ptr_is_owned(_res)) return;
17642         void* _res_ptr = untag_ptr(_res);
17643         CHECK_ACCESS(_res_ptr);
17644         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
17645         FREE(untag_ptr(_res));
17646         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
17647 }
17648
17649 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
17650         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17651         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
17652         return tag_ptr(ret_conv, true);
17653 }
17654 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17655         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
17656         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
17657         return ret_conv;
17658 }
17659
17660 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
17661         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
17662         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17663         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
17664         return tag_ptr(ret_conv, true);
17665 }
17666
17667 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
17668         LDKHTLCDescriptor o_conv;
17669         o_conv.inner = untag_ptr(o);
17670         o_conv.is_owned = ptr_is_owned(o);
17671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17672         o_conv = HTLCDescriptor_clone(&o_conv);
17673         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17674         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
17675         return tag_ptr(ret_conv, true);
17676 }
17677
17678 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
17679         void* e_ptr = untag_ptr(e);
17680         CHECK_ACCESS(e_ptr);
17681         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17682         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17683         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17684         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
17685         return tag_ptr(ret_conv, true);
17686 }
17687
17688 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17689         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
17690         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
17691         return ret_conv;
17692 }
17693
17694 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
17695         if (!ptr_is_owned(_res)) return;
17696         void* _res_ptr = untag_ptr(_res);
17697         CHECK_ACCESS(_res_ptr);
17698         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
17699         FREE(untag_ptr(_res));
17700         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
17701 }
17702
17703 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17704         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17705         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
17706         return tag_ptr(ret_conv, true);
17707 }
17708 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17709         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
17710         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17711         return ret_conv;
17712 }
17713
17714 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
17715         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
17716         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17717         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
17718         return tag_ptr(ret_conv, true);
17719 }
17720
17721 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
17722         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17723         *ret_conv = CResult_NoneNoneZ_ok();
17724         return tag_ptr(ret_conv, true);
17725 }
17726
17727 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
17728         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17729         *ret_conv = CResult_NoneNoneZ_err();
17730         return tag_ptr(ret_conv, true);
17731 }
17732
17733 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
17734         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
17735         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
17736         return ret_conv;
17737 }
17738
17739 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
17740         if (!ptr_is_owned(_res)) return;
17741         void* _res_ptr = untag_ptr(_res);
17742         CHECK_ACCESS(_res_ptr);
17743         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
17744         FREE(untag_ptr(_res));
17745         CResult_NoneNoneZ_free(_res_conv);
17746 }
17747
17748 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
17749         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17750         *ret_conv = CResult_NoneNoneZ_clone(arg);
17751         return tag_ptr(ret_conv, true);
17752 }
17753 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
17754         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
17755         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
17756         return ret_conv;
17757 }
17758
17759 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
17760         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
17761         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17762         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
17763         return tag_ptr(ret_conv, true);
17764 }
17765
17766 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
17767         LDKPublicKey o_ref;
17768         CHECK(o->arr_len == 33);
17769         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
17770         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17771         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
17772         return tag_ptr(ret_conv, true);
17773 }
17774
17775 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
17776         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17777         *ret_conv = CResult_PublicKeyNoneZ_err();
17778         return tag_ptr(ret_conv, true);
17779 }
17780
17781 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
17782         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
17783         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
17784         return ret_conv;
17785 }
17786
17787 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
17788         if (!ptr_is_owned(_res)) return;
17789         void* _res_ptr = untag_ptr(_res);
17790         CHECK_ACCESS(_res_ptr);
17791         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
17792         FREE(untag_ptr(_res));
17793         CResult_PublicKeyNoneZ_free(_res_conv);
17794 }
17795
17796 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
17797         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17798         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
17799         return tag_ptr(ret_conv, true);
17800 }
17801 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
17802         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
17803         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
17804         return ret_conv;
17805 }
17806
17807 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
17808         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
17809         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17810         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
17811         return tag_ptr(ret_conv, true);
17812 }
17813
17814 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
17815         void* o_ptr = untag_ptr(o);
17816         CHECK_ACCESS(o_ptr);
17817         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
17818         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
17819         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17820         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
17821         uint64_t ret_ref = tag_ptr(ret_copy, true);
17822         return ret_ref;
17823 }
17824
17825 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
17826         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17827         *ret_copy = COption_BigEndianScalarZ_none();
17828         uint64_t ret_ref = tag_ptr(ret_copy, true);
17829         return ret_ref;
17830 }
17831
17832 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
17833         if (!ptr_is_owned(_res)) return;
17834         void* _res_ptr = untag_ptr(_res);
17835         CHECK_ACCESS(_res_ptr);
17836         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
17837         FREE(untag_ptr(_res));
17838         COption_BigEndianScalarZ_free(_res_conv);
17839 }
17840
17841 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
17842         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17843         *ret_copy = COption_BigEndianScalarZ_clone(arg);
17844         uint64_t ret_ref = tag_ptr(ret_copy, true);
17845         return ret_ref;
17846 }
17847 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
17848         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
17849         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
17850         return ret_conv;
17851 }
17852
17853 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
17854         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
17855         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17856         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
17857         uint64_t ret_ref = tag_ptr(ret_copy, true);
17858         return ret_ref;
17859 }
17860
17861 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
17862         LDKCVec_U5Z _res_constr;
17863         _res_constr.datalen = _res->arr_len;
17864         if (_res_constr.datalen > 0)
17865                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
17866         else
17867                 _res_constr.data = NULL;
17868         int8_t* _res_vals = (void*) _res->elems;
17869         for (size_t h = 0; h < _res_constr.datalen; h++) {
17870                 int8_t _res_conv_7 = _res_vals[h];
17871                 
17872                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
17873         }
17874         FREE(_res);
17875         CVec_U5Z_free(_res_constr);
17876 }
17877
17878 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
17879         LDKRecoverableSignature o_ref;
17880         CHECK(o->arr_len == 68);
17881         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
17882         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17883         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17884         return tag_ptr(ret_conv, true);
17885 }
17886
17887 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
17888         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17889         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17890         return tag_ptr(ret_conv, true);
17891 }
17892
17893 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
17894         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
17895         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17896         return ret_conv;
17897 }
17898
17899 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
17900         if (!ptr_is_owned(_res)) return;
17901         void* _res_ptr = untag_ptr(_res);
17902         CHECK_ACCESS(_res_ptr);
17903         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17904         FREE(untag_ptr(_res));
17905         CResult_RecoverableSignatureNoneZ_free(_res_conv);
17906 }
17907
17908 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17909         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17910         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17911         return tag_ptr(ret_conv, true);
17912 }
17913 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
17914         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
17915         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
17916         return ret_conv;
17917 }
17918
17919 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
17920         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
17921         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17922         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
17923         return tag_ptr(ret_conv, true);
17924 }
17925
17926 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
17927         LDKSchnorrSignature o_ref;
17928         CHECK(o->arr_len == 64);
17929         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
17930         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17931         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
17932         return tag_ptr(ret_conv, true);
17933 }
17934
17935 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
17936         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17937         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
17938         return tag_ptr(ret_conv, true);
17939 }
17940
17941 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
17942         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
17943         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
17944         return ret_conv;
17945 }
17946
17947 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
17948         if (!ptr_is_owned(_res)) return;
17949         void* _res_ptr = untag_ptr(_res);
17950         CHECK_ACCESS(_res_ptr);
17951         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
17952         FREE(untag_ptr(_res));
17953         CResult_SchnorrSignatureNoneZ_free(_res_conv);
17954 }
17955
17956 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
17957         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17958         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
17959         return tag_ptr(ret_conv, true);
17960 }
17961 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
17962         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
17963         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
17964         return ret_conv;
17965 }
17966
17967 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
17968         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
17969         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17970         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
17971         return tag_ptr(ret_conv, true);
17972 }
17973
17974 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
17975         LDKECDSASignature o_ref;
17976         CHECK(o->arr_len == 64);
17977         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
17978         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
17979         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
17980         return tag_ptr(ret_conv, true);
17981 }
17982
17983 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
17984         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
17985         *ret_conv = CResult_ECDSASignatureNoneZ_err();
17986         return tag_ptr(ret_conv, true);
17987 }
17988
17989 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
17990         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
17991         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
17992         return ret_conv;
17993 }
17994
17995 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
17996         if (!ptr_is_owned(_res)) return;
17997         void* _res_ptr = untag_ptr(_res);
17998         CHECK_ACCESS(_res_ptr);
17999         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
18000         FREE(untag_ptr(_res));
18001         CResult_ECDSASignatureNoneZ_free(_res_conv);
18002 }
18003
18004 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
18005         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18006         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
18007         return tag_ptr(ret_conv, true);
18008 }
18009 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
18010         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
18011         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
18012         return ret_conv;
18013 }
18014
18015 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
18016         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
18017         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18018         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
18019         return tag_ptr(ret_conv, true);
18020 }
18021
18022 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
18023         void* o_ptr = untag_ptr(o);
18024         CHECK_ACCESS(o_ptr);
18025         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
18026         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
18027                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18028                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
18029         }
18030         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18031         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
18032         return tag_ptr(ret_conv, true);
18033 }
18034
18035 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
18036         void* e_ptr = untag_ptr(e);
18037         CHECK_ACCESS(e_ptr);
18038         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18039         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18040         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18041         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
18042         return tag_ptr(ret_conv, true);
18043 }
18044
18045 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
18046         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
18047         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
18048         return ret_conv;
18049 }
18050
18051 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
18052         if (!ptr_is_owned(_res)) return;
18053         void* _res_ptr = untag_ptr(_res);
18054         CHECK_ACCESS(_res_ptr);
18055         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
18056         FREE(untag_ptr(_res));
18057         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
18058 }
18059
18060 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
18061         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18062         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
18063         return tag_ptr(ret_conv, true);
18064 }
18065 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
18066         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
18067         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
18068         return ret_conv;
18069 }
18070
18071 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
18072         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
18073         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18074         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
18075         return tag_ptr(ret_conv, true);
18076 }
18077
18078 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
18079         LDKCVec_u8Z o_ref;
18080         o_ref.datalen = o->arr_len;
18081         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18082         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18083         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18084         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
18085         return tag_ptr(ret_conv, true);
18086 }
18087
18088 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
18089         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18090         *ret_conv = CResult_CVec_u8ZNoneZ_err();
18091         return tag_ptr(ret_conv, true);
18092 }
18093
18094 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
18095         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
18096         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
18097         return ret_conv;
18098 }
18099
18100 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
18101         if (!ptr_is_owned(_res)) return;
18102         void* _res_ptr = untag_ptr(_res);
18103         CHECK_ACCESS(_res_ptr);
18104         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
18105         FREE(untag_ptr(_res));
18106         CResult_CVec_u8ZNoneZ_free(_res_conv);
18107 }
18108
18109 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
18110         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18111         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
18112         return tag_ptr(ret_conv, true);
18113 }
18114 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
18115         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
18116         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
18117         return ret_conv;
18118 }
18119
18120 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
18121         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
18122         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18123         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
18124         return tag_ptr(ret_conv, true);
18125 }
18126
18127 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
18128         LDKShutdownScript o_conv;
18129         o_conv.inner = untag_ptr(o);
18130         o_conv.is_owned = ptr_is_owned(o);
18131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18132         o_conv = ShutdownScript_clone(&o_conv);
18133         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18134         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
18135         return tag_ptr(ret_conv, true);
18136 }
18137
18138 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
18139         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18140         *ret_conv = CResult_ShutdownScriptNoneZ_err();
18141         return tag_ptr(ret_conv, true);
18142 }
18143
18144 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
18145         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
18146         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
18147         return ret_conv;
18148 }
18149
18150 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
18151         if (!ptr_is_owned(_res)) return;
18152         void* _res_ptr = untag_ptr(_res);
18153         CHECK_ACCESS(_res_ptr);
18154         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
18155         FREE(untag_ptr(_res));
18156         CResult_ShutdownScriptNoneZ_free(_res_conv);
18157 }
18158
18159 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
18160         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18161         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
18162         return tag_ptr(ret_conv, true);
18163 }
18164 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
18165         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
18166         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
18167         return ret_conv;
18168 }
18169
18170 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
18171         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
18172         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18173         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
18174         return tag_ptr(ret_conv, true);
18175 }
18176
18177 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
18178         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18179         *ret_copy = COption_u16Z_some(o);
18180         uint64_t ret_ref = tag_ptr(ret_copy, true);
18181         return ret_ref;
18182 }
18183
18184 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
18185         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18186         *ret_copy = COption_u16Z_none();
18187         uint64_t ret_ref = tag_ptr(ret_copy, true);
18188         return ret_ref;
18189 }
18190
18191 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
18192         if (!ptr_is_owned(_res)) return;
18193         void* _res_ptr = untag_ptr(_res);
18194         CHECK_ACCESS(_res_ptr);
18195         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18196         FREE(untag_ptr(_res));
18197         COption_u16Z_free(_res_conv);
18198 }
18199
18200 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18201         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18202         *ret_copy = COption_u16Z_clone(arg);
18203         uint64_t ret_ref = tag_ptr(ret_copy, true);
18204         return ret_ref;
18205 }
18206 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
18207         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18208         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18209         return ret_conv;
18210 }
18211
18212 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
18213         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18214         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18215         *ret_copy = COption_u16Z_clone(orig_conv);
18216         uint64_t ret_ref = tag_ptr(ret_copy, true);
18217         return ret_ref;
18218 }
18219
18220 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
18221         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18222         *ret_copy = COption_boolZ_some(o);
18223         uint64_t ret_ref = tag_ptr(ret_copy, true);
18224         return ret_ref;
18225 }
18226
18227 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
18228         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18229         *ret_copy = COption_boolZ_none();
18230         uint64_t ret_ref = tag_ptr(ret_copy, true);
18231         return ret_ref;
18232 }
18233
18234 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
18235         if (!ptr_is_owned(_res)) return;
18236         void* _res_ptr = untag_ptr(_res);
18237         CHECK_ACCESS(_res_ptr);
18238         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
18239         FREE(untag_ptr(_res));
18240         COption_boolZ_free(_res_conv);
18241 }
18242
18243 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
18244         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18245         *ret_copy = COption_boolZ_clone(arg);
18246         uint64_t ret_ref = tag_ptr(ret_copy, true);
18247         return ret_ref;
18248 }
18249 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
18250         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
18251         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
18252         return ret_conv;
18253 }
18254
18255 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
18256         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
18257         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18258         *ret_copy = COption_boolZ_clone(orig_conv);
18259         uint64_t ret_ref = tag_ptr(ret_copy, true);
18260         return ret_ref;
18261 }
18262
18263 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_ok"))) TS_CResult_WitnessNoneZ_ok(int8_tArray o) {
18264         LDKWitness o_ref;
18265         o_ref.datalen = o->arr_len;
18266         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
18267         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18268         o_ref.data_is_owned = true;
18269         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18270         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
18271         return tag_ptr(ret_conv, true);
18272 }
18273
18274 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_err"))) TS_CResult_WitnessNoneZ_err() {
18275         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18276         *ret_conv = CResult_WitnessNoneZ_err();
18277         return tag_ptr(ret_conv, true);
18278 }
18279
18280 jboolean  __attribute__((export_name("TS_CResult_WitnessNoneZ_is_ok"))) TS_CResult_WitnessNoneZ_is_ok(uint64_t o) {
18281         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
18282         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
18283         return ret_conv;
18284 }
18285
18286 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_free"))) TS_CResult_WitnessNoneZ_free(uint64_t _res) {
18287         if (!ptr_is_owned(_res)) return;
18288         void* _res_ptr = untag_ptr(_res);
18289         CHECK_ACCESS(_res_ptr);
18290         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
18291         FREE(untag_ptr(_res));
18292         CResult_WitnessNoneZ_free(_res_conv);
18293 }
18294
18295 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
18296         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18297         *ret_conv = CResult_WitnessNoneZ_clone(arg);
18298         return tag_ptr(ret_conv, true);
18299 }
18300 int64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone_ptr"))) TS_CResult_WitnessNoneZ_clone_ptr(uint64_t arg) {
18301         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
18302         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
18303         return ret_conv;
18304 }
18305
18306 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone"))) TS_CResult_WitnessNoneZ_clone(uint64_t orig) {
18307         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
18308         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18309         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
18310         return tag_ptr(ret_conv, true);
18311 }
18312
18313 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
18314         LDKCVec_ECDSASignatureZ _res_constr;
18315         _res_constr.datalen = _res->arr_len;
18316         if (_res_constr.datalen > 0)
18317                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18318         else
18319                 _res_constr.data = NULL;
18320         int8_tArray* _res_vals = (void*) _res->elems;
18321         for (size_t m = 0; m < _res_constr.datalen; m++) {
18322                 int8_tArray _res_conv_12 = _res_vals[m];
18323                 LDKECDSASignature _res_conv_12_ref;
18324                 CHECK(_res_conv_12->arr_len == 64);
18325                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
18326                 _res_constr.data[m] = _res_conv_12_ref;
18327         }
18328         FREE(_res);
18329         CVec_ECDSASignatureZ_free(_res_constr);
18330 }
18331
18332 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
18333         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18334         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
18335         return tag_ptr(ret_conv, true);
18336 }
18337 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
18338         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
18339         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
18340         return ret_conv;
18341 }
18342
18343 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
18344         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
18345         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18346         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
18347         return tag_ptr(ret_conv, true);
18348 }
18349
18350 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
18351         LDKECDSASignature a_ref;
18352         CHECK(a->arr_len == 64);
18353         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
18354         LDKCVec_ECDSASignatureZ b_constr;
18355         b_constr.datalen = b->arr_len;
18356         if (b_constr.datalen > 0)
18357                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18358         else
18359                 b_constr.data = NULL;
18360         int8_tArray* b_vals = (void*) b->elems;
18361         for (size_t m = 0; m < b_constr.datalen; m++) {
18362                 int8_tArray b_conv_12 = b_vals[m];
18363                 LDKECDSASignature b_conv_12_ref;
18364                 CHECK(b_conv_12->arr_len == 64);
18365                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
18366                 b_constr.data[m] = b_conv_12_ref;
18367         }
18368         FREE(b);
18369         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18370         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
18371         return tag_ptr(ret_conv, true);
18372 }
18373
18374 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
18375         if (!ptr_is_owned(_res)) return;
18376         void* _res_ptr = untag_ptr(_res);
18377         CHECK_ACCESS(_res_ptr);
18378         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
18379         FREE(untag_ptr(_res));
18380         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
18381 }
18382
18383 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
18384         void* o_ptr = untag_ptr(o);
18385         CHECK_ACCESS(o_ptr);
18386         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
18387         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
18388         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18389         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
18390         return tag_ptr(ret_conv, true);
18391 }
18392
18393 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
18394         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18395         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
18396         return tag_ptr(ret_conv, true);
18397 }
18398
18399 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
18400         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
18401         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
18402         return ret_conv;
18403 }
18404
18405 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
18406         if (!ptr_is_owned(_res)) return;
18407         void* _res_ptr = untag_ptr(_res);
18408         CHECK_ACCESS(_res_ptr);
18409         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
18410         FREE(untag_ptr(_res));
18411         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
18412 }
18413
18414 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
18415         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18416         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
18417         return tag_ptr(ret_conv, true);
18418 }
18419 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
18420         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
18421         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
18422         return ret_conv;
18423 }
18424
18425 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
18426         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
18427         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18428         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
18429         return tag_ptr(ret_conv, true);
18430 }
18431
18432 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
18433         LDKInMemorySigner o_conv;
18434         o_conv.inner = untag_ptr(o);
18435         o_conv.is_owned = ptr_is_owned(o);
18436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18437         o_conv = InMemorySigner_clone(&o_conv);
18438         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18439         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18440         return tag_ptr(ret_conv, true);
18441 }
18442
18443 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
18444         void* e_ptr = untag_ptr(e);
18445         CHECK_ACCESS(e_ptr);
18446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18448         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18449         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18450         return tag_ptr(ret_conv, true);
18451 }
18452
18453 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
18454         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
18455         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18456         return ret_conv;
18457 }
18458
18459 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
18460         if (!ptr_is_owned(_res)) return;
18461         void* _res_ptr = untag_ptr(_res);
18462         CHECK_ACCESS(_res_ptr);
18463         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18464         FREE(untag_ptr(_res));
18465         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18466 }
18467
18468 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18469         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18470         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18471         return tag_ptr(ret_conv, true);
18472 }
18473 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
18474         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
18475         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18476         return ret_conv;
18477 }
18478
18479 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
18480         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
18481         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18482         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18483         return tag_ptr(ret_conv, true);
18484 }
18485
18486 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
18487         LDKTransaction o_ref;
18488         o_ref.datalen = o->arr_len;
18489         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18490         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18491         o_ref.data_is_owned = true;
18492         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18493         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18494         return tag_ptr(ret_conv, true);
18495 }
18496
18497 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
18498         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18499         *ret_conv = CResult_TransactionNoneZ_err();
18500         return tag_ptr(ret_conv, true);
18501 }
18502
18503 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
18504         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
18505         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18506         return ret_conv;
18507 }
18508
18509 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
18510         if (!ptr_is_owned(_res)) return;
18511         void* _res_ptr = untag_ptr(_res);
18512         CHECK_ACCESS(_res_ptr);
18513         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18514         FREE(untag_ptr(_res));
18515         CResult_TransactionNoneZ_free(_res_conv);
18516 }
18517
18518 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18519         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18520         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18521         return tag_ptr(ret_conv, true);
18522 }
18523 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
18524         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18525         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18526         return ret_conv;
18527 }
18528
18529 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
18530         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18531         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18532         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18533         return tag_ptr(ret_conv, true);
18534 }
18535
18536 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
18537         LDKCVec_ChannelDetailsZ _res_constr;
18538         _res_constr.datalen = _res->arr_len;
18539         if (_res_constr.datalen > 0)
18540                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18541         else
18542                 _res_constr.data = NULL;
18543         uint64_t* _res_vals = _res->elems;
18544         for (size_t q = 0; q < _res_constr.datalen; q++) {
18545                 uint64_t _res_conv_16 = _res_vals[q];
18546                 LDKChannelDetails _res_conv_16_conv;
18547                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18548                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18549                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18550                 _res_constr.data[q] = _res_conv_16_conv;
18551         }
18552         FREE(_res);
18553         CVec_ChannelDetailsZ_free(_res_constr);
18554 }
18555
18556 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
18557         LDKRoute o_conv;
18558         o_conv.inner = untag_ptr(o);
18559         o_conv.is_owned = ptr_is_owned(o);
18560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18561         o_conv = Route_clone(&o_conv);
18562         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18563         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
18564         return tag_ptr(ret_conv, true);
18565 }
18566
18567 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
18568         LDKLightningError e_conv;
18569         e_conv.inner = untag_ptr(e);
18570         e_conv.is_owned = ptr_is_owned(e);
18571         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18572         e_conv = LightningError_clone(&e_conv);
18573         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18574         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
18575         return tag_ptr(ret_conv, true);
18576 }
18577
18578 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
18579         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
18580         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
18581         return ret_conv;
18582 }
18583
18584 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
18585         if (!ptr_is_owned(_res)) return;
18586         void* _res_ptr = untag_ptr(_res);
18587         CHECK_ACCESS(_res_ptr);
18588         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
18589         FREE(untag_ptr(_res));
18590         CResult_RouteLightningErrorZ_free(_res_conv);
18591 }
18592
18593 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
18594         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18595         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
18596         return tag_ptr(ret_conv, true);
18597 }
18598 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
18599         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
18600         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
18601         return ret_conv;
18602 }
18603
18604 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
18605         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
18606         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18607         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
18608         return tag_ptr(ret_conv, true);
18609 }
18610
18611 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
18612         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18613         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
18614         return tag_ptr(ret_conv, true);
18615 }
18616 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
18617         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
18618         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
18619         return ret_conv;
18620 }
18621
18622 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
18623         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
18624         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18625         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
18626         return tag_ptr(ret_conv, true);
18627 }
18628
18629 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
18630         LDKBlindedPayInfo a_conv;
18631         a_conv.inner = untag_ptr(a);
18632         a_conv.is_owned = ptr_is_owned(a);
18633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18634         a_conv = BlindedPayInfo_clone(&a_conv);
18635         LDKBlindedPath b_conv;
18636         b_conv.inner = untag_ptr(b);
18637         b_conv.is_owned = ptr_is_owned(b);
18638         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18639         b_conv = BlindedPath_clone(&b_conv);
18640         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18641         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
18642         return tag_ptr(ret_conv, true);
18643 }
18644
18645 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
18646         if (!ptr_is_owned(_res)) return;
18647         void* _res_ptr = untag_ptr(_res);
18648         CHECK_ACCESS(_res_ptr);
18649         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
18650         FREE(untag_ptr(_res));
18651         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
18652 }
18653
18654 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
18655         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
18656         _res_constr.datalen = _res->arr_len;
18657         if (_res_constr.datalen > 0)
18658                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18659         else
18660                 _res_constr.data = NULL;
18661         uint64_t* _res_vals = _res->elems;
18662         for (size_t l = 0; l < _res_constr.datalen; l++) {
18663                 uint64_t _res_conv_37 = _res_vals[l];
18664                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
18665                 CHECK_ACCESS(_res_conv_37_ptr);
18666                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
18667                 FREE(untag_ptr(_res_conv_37));
18668                 _res_constr.data[l] = _res_conv_37_conv;
18669         }
18670         FREE(_res);
18671         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
18672 }
18673
18674 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(uint64_tArray o) {
18675         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
18676         o_constr.datalen = o->arr_len;
18677         if (o_constr.datalen > 0)
18678                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18679         else
18680                 o_constr.data = NULL;
18681         uint64_t* o_vals = o->elems;
18682         for (size_t l = 0; l < o_constr.datalen; l++) {
18683                 uint64_t o_conv_37 = o_vals[l];
18684                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
18685                 CHECK_ACCESS(o_conv_37_ptr);
18686                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
18687                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
18688                 o_constr.data[l] = o_conv_37_conv;
18689         }
18690         FREE(o);
18691         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18692         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
18693         return tag_ptr(ret_conv, true);
18694 }
18695
18696 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
18697         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18698         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
18699         return tag_ptr(ret_conv, true);
18700 }
18701
18702 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(uint64_t o) {
18703         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
18704         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
18705         return ret_conv;
18706 }
18707
18708 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(uint64_t _res) {
18709         if (!ptr_is_owned(_res)) return;
18710         void* _res_ptr = untag_ptr(_res);
18711         CHECK_ACCESS(_res_ptr);
18712         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
18713         FREE(untag_ptr(_res));
18714         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
18715 }
18716
18717 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
18718         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18719         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
18720         return tag_ptr(ret_conv, true);
18721 }
18722 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(uint64_t arg) {
18723         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
18724         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
18725         return ret_conv;
18726 }
18727
18728 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(uint64_t orig) {
18729         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
18730         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18731         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
18732         return tag_ptr(ret_conv, true);
18733 }
18734
18735 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
18736         LDKCVec_PublicKeyZ _res_constr;
18737         _res_constr.datalen = _res->arr_len;
18738         if (_res_constr.datalen > 0)
18739                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18740         else
18741                 _res_constr.data = NULL;
18742         int8_tArray* _res_vals = (void*) _res->elems;
18743         for (size_t m = 0; m < _res_constr.datalen; m++) {
18744                 int8_tArray _res_conv_12 = _res_vals[m];
18745                 LDKPublicKey _res_conv_12_ref;
18746                 CHECK(_res_conv_12->arr_len == 33);
18747                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
18748                 _res_constr.data[m] = _res_conv_12_ref;
18749         }
18750         FREE(_res);
18751         CVec_PublicKeyZ_free(_res_constr);
18752 }
18753
18754 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
18755         LDKOnionMessagePath o_conv;
18756         o_conv.inner = untag_ptr(o);
18757         o_conv.is_owned = ptr_is_owned(o);
18758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18759         o_conv = OnionMessagePath_clone(&o_conv);
18760         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18761         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
18762         return tag_ptr(ret_conv, true);
18763 }
18764
18765 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
18766         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18767         *ret_conv = CResult_OnionMessagePathNoneZ_err();
18768         return tag_ptr(ret_conv, true);
18769 }
18770
18771 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
18772         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
18773         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
18774         return ret_conv;
18775 }
18776
18777 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
18778         if (!ptr_is_owned(_res)) return;
18779         void* _res_ptr = untag_ptr(_res);
18780         CHECK_ACCESS(_res_ptr);
18781         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
18782         FREE(untag_ptr(_res));
18783         CResult_OnionMessagePathNoneZ_free(_res_conv);
18784 }
18785
18786 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
18787         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18788         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
18789         return tag_ptr(ret_conv, true);
18790 }
18791 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
18792         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
18793         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
18794         return ret_conv;
18795 }
18796
18797 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
18798         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
18799         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18800         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
18801         return tag_ptr(ret_conv, true);
18802 }
18803
18804 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_ok(uint64_tArray o) {
18805         LDKCVec_BlindedPathZ o_constr;
18806         o_constr.datalen = o->arr_len;
18807         if (o_constr.datalen > 0)
18808                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18809         else
18810                 o_constr.data = NULL;
18811         uint64_t* o_vals = o->elems;
18812         for (size_t n = 0; n < o_constr.datalen; n++) {
18813                 uint64_t o_conv_13 = o_vals[n];
18814                 LDKBlindedPath o_conv_13_conv;
18815                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
18816                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
18817                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
18818                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
18819                 o_constr.data[n] = o_conv_13_conv;
18820         }
18821         FREE(o);
18822         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18823         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
18824         return tag_ptr(ret_conv, true);
18825 }
18826
18827 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_err"))) TS_CResult_CVec_BlindedPathZNoneZ_err() {
18828         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18829         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
18830         return tag_ptr(ret_conv, true);
18831 }
18832
18833 jboolean  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_is_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_is_ok(uint64_t o) {
18834         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
18835         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
18836         return ret_conv;
18837 }
18838
18839 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_free"))) TS_CResult_CVec_BlindedPathZNoneZ_free(uint64_t _res) {
18840         if (!ptr_is_owned(_res)) return;
18841         void* _res_ptr = untag_ptr(_res);
18842         CHECK_ACCESS(_res_ptr);
18843         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
18844         FREE(untag_ptr(_res));
18845         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
18846 }
18847
18848 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
18849         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18850         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
18851         return tag_ptr(ret_conv, true);
18852 }
18853 int64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr"))) TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr(uint64_t arg) {
18854         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
18855         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
18856         return ret_conv;
18857 }
18858
18859 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone"))) TS_CResult_CVec_BlindedPathZNoneZ_clone(uint64_t orig) {
18860         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
18861         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18862         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
18863         return tag_ptr(ret_conv, true);
18864 }
18865
18866 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
18867         LDKInFlightHtlcs o_conv;
18868         o_conv.inner = untag_ptr(o);
18869         o_conv.is_owned = ptr_is_owned(o);
18870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18871         o_conv = InFlightHtlcs_clone(&o_conv);
18872         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18873         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
18874         return tag_ptr(ret_conv, true);
18875 }
18876
18877 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
18878         void* e_ptr = untag_ptr(e);
18879         CHECK_ACCESS(e_ptr);
18880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18882         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18883         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
18884         return tag_ptr(ret_conv, true);
18885 }
18886
18887 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
18888         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
18889         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
18890         return ret_conv;
18891 }
18892
18893 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
18894         if (!ptr_is_owned(_res)) return;
18895         void* _res_ptr = untag_ptr(_res);
18896         CHECK_ACCESS(_res_ptr);
18897         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
18898         FREE(untag_ptr(_res));
18899         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
18900 }
18901
18902 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
18903         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18904         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
18905         return tag_ptr(ret_conv, true);
18906 }
18907 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
18908         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
18909         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
18910         return ret_conv;
18911 }
18912
18913 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
18914         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
18915         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18916         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
18917         return tag_ptr(ret_conv, true);
18918 }
18919
18920 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
18921         LDKRouteHop o_conv;
18922         o_conv.inner = untag_ptr(o);
18923         o_conv.is_owned = ptr_is_owned(o);
18924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18925         o_conv = RouteHop_clone(&o_conv);
18926         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18927         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
18928         return tag_ptr(ret_conv, true);
18929 }
18930
18931 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
18932         void* e_ptr = untag_ptr(e);
18933         CHECK_ACCESS(e_ptr);
18934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18936         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18937         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
18938         return tag_ptr(ret_conv, true);
18939 }
18940
18941 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
18942         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
18943         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
18944         return ret_conv;
18945 }
18946
18947 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
18948         if (!ptr_is_owned(_res)) return;
18949         void* _res_ptr = untag_ptr(_res);
18950         CHECK_ACCESS(_res_ptr);
18951         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
18952         FREE(untag_ptr(_res));
18953         CResult_RouteHopDecodeErrorZ_free(_res_conv);
18954 }
18955
18956 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
18957         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18958         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
18959         return tag_ptr(ret_conv, true);
18960 }
18961 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
18962         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
18963         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
18964         return ret_conv;
18965 }
18966
18967 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
18968         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
18969         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18970         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
18971         return tag_ptr(ret_conv, true);
18972 }
18973
18974 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
18975         LDKCVec_BlindedHopZ _res_constr;
18976         _res_constr.datalen = _res->arr_len;
18977         if (_res_constr.datalen > 0)
18978                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
18979         else
18980                 _res_constr.data = NULL;
18981         uint64_t* _res_vals = _res->elems;
18982         for (size_t m = 0; m < _res_constr.datalen; m++) {
18983                 uint64_t _res_conv_12 = _res_vals[m];
18984                 LDKBlindedHop _res_conv_12_conv;
18985                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
18986                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
18987                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
18988                 _res_constr.data[m] = _res_conv_12_conv;
18989         }
18990         FREE(_res);
18991         CVec_BlindedHopZ_free(_res_constr);
18992 }
18993
18994 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
18995         LDKBlindedTail o_conv;
18996         o_conv.inner = untag_ptr(o);
18997         o_conv.is_owned = ptr_is_owned(o);
18998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18999         o_conv = BlindedTail_clone(&o_conv);
19000         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19001         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
19002         return tag_ptr(ret_conv, true);
19003 }
19004
19005 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
19006         void* e_ptr = untag_ptr(e);
19007         CHECK_ACCESS(e_ptr);
19008         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19009         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19010         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19011         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
19012         return tag_ptr(ret_conv, true);
19013 }
19014
19015 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
19016         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
19017         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
19018         return ret_conv;
19019 }
19020
19021 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
19022         if (!ptr_is_owned(_res)) return;
19023         void* _res_ptr = untag_ptr(_res);
19024         CHECK_ACCESS(_res_ptr);
19025         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
19026         FREE(untag_ptr(_res));
19027         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
19028 }
19029
19030 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
19031         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19032         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
19033         return tag_ptr(ret_conv, true);
19034 }
19035 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
19036         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
19037         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
19038         return ret_conv;
19039 }
19040
19041 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
19042         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
19043         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19044         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
19045         return tag_ptr(ret_conv, true);
19046 }
19047
19048 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
19049         LDKCVec_RouteHopZ _res_constr;
19050         _res_constr.datalen = _res->arr_len;
19051         if (_res_constr.datalen > 0)
19052                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19053         else
19054                 _res_constr.data = NULL;
19055         uint64_t* _res_vals = _res->elems;
19056         for (size_t k = 0; k < _res_constr.datalen; k++) {
19057                 uint64_t _res_conv_10 = _res_vals[k];
19058                 LDKRouteHop _res_conv_10_conv;
19059                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
19060                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
19061                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19062                 _res_constr.data[k] = _res_conv_10_conv;
19063         }
19064         FREE(_res);
19065         CVec_RouteHopZ_free(_res_constr);
19066 }
19067
19068 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
19069         LDKCVec_PathZ _res_constr;
19070         _res_constr.datalen = _res->arr_len;
19071         if (_res_constr.datalen > 0)
19072                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
19073         else
19074                 _res_constr.data = NULL;
19075         uint64_t* _res_vals = _res->elems;
19076         for (size_t g = 0; g < _res_constr.datalen; g++) {
19077                 uint64_t _res_conv_6 = _res_vals[g];
19078                 LDKPath _res_conv_6_conv;
19079                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
19080                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
19081                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
19082                 _res_constr.data[g] = _res_conv_6_conv;
19083         }
19084         FREE(_res);
19085         CVec_PathZ_free(_res_constr);
19086 }
19087
19088 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
19089         LDKRoute o_conv;
19090         o_conv.inner = untag_ptr(o);
19091         o_conv.is_owned = ptr_is_owned(o);
19092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19093         o_conv = Route_clone(&o_conv);
19094         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19095         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
19096         return tag_ptr(ret_conv, true);
19097 }
19098
19099 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
19100         void* e_ptr = untag_ptr(e);
19101         CHECK_ACCESS(e_ptr);
19102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19104         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19105         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
19106         return tag_ptr(ret_conv, true);
19107 }
19108
19109 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
19110         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
19111         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
19112         return ret_conv;
19113 }
19114
19115 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
19116         if (!ptr_is_owned(_res)) return;
19117         void* _res_ptr = untag_ptr(_res);
19118         CHECK_ACCESS(_res_ptr);
19119         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
19120         FREE(untag_ptr(_res));
19121         CResult_RouteDecodeErrorZ_free(_res_conv);
19122 }
19123
19124 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
19125         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19126         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
19127         return tag_ptr(ret_conv, true);
19128 }
19129 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
19130         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
19131         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
19132         return ret_conv;
19133 }
19134
19135 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
19136         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
19137         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19138         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
19139         return tag_ptr(ret_conv, true);
19140 }
19141
19142 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
19143         LDKRouteParameters o_conv;
19144         o_conv.inner = untag_ptr(o);
19145         o_conv.is_owned = ptr_is_owned(o);
19146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19147         o_conv = RouteParameters_clone(&o_conv);
19148         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19149         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
19150         return tag_ptr(ret_conv, true);
19151 }
19152
19153 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
19154         void* e_ptr = untag_ptr(e);
19155         CHECK_ACCESS(e_ptr);
19156         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19157         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19158         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19159         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
19160         return tag_ptr(ret_conv, true);
19161 }
19162
19163 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
19164         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
19165         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
19166         return ret_conv;
19167 }
19168
19169 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
19170         if (!ptr_is_owned(_res)) return;
19171         void* _res_ptr = untag_ptr(_res);
19172         CHECK_ACCESS(_res_ptr);
19173         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
19174         FREE(untag_ptr(_res));
19175         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
19176 }
19177
19178 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
19179         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19180         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
19181         return tag_ptr(ret_conv, true);
19182 }
19183 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19184         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
19185         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
19186         return ret_conv;
19187 }
19188
19189 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
19190         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
19191         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19192         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
19193         return tag_ptr(ret_conv, true);
19194 }
19195
19196 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
19197         LDKCVec_u64Z _res_constr;
19198         _res_constr.datalen = _res->arr_len;
19199         if (_res_constr.datalen > 0)
19200                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19201         else
19202                 _res_constr.data = NULL;
19203         int64_t* _res_vals = _res->elems;
19204         for (size_t i = 0; i < _res_constr.datalen; i++) {
19205                 int64_t _res_conv_8 = _res_vals[i];
19206                 _res_constr.data[i] = _res_conv_8;
19207         }
19208         FREE(_res);
19209         CVec_u64Z_free(_res_constr);
19210 }
19211
19212 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
19213         LDKPaymentParameters o_conv;
19214         o_conv.inner = untag_ptr(o);
19215         o_conv.is_owned = ptr_is_owned(o);
19216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19217         o_conv = PaymentParameters_clone(&o_conv);
19218         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19219         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
19220         return tag_ptr(ret_conv, true);
19221 }
19222
19223 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
19224         void* e_ptr = untag_ptr(e);
19225         CHECK_ACCESS(e_ptr);
19226         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19227         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19228         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19229         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
19230         return tag_ptr(ret_conv, true);
19231 }
19232
19233 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
19234         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
19235         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
19236         return ret_conv;
19237 }
19238
19239 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
19240         if (!ptr_is_owned(_res)) return;
19241         void* _res_ptr = untag_ptr(_res);
19242         CHECK_ACCESS(_res_ptr);
19243         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
19244         FREE(untag_ptr(_res));
19245         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
19246 }
19247
19248 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
19249         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19250         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
19251         return tag_ptr(ret_conv, true);
19252 }
19253 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19254         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
19255         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
19256         return ret_conv;
19257 }
19258
19259 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
19260         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
19261         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19262         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
19263         return tag_ptr(ret_conv, true);
19264 }
19265
19266 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
19267         LDKCVec_RouteHintZ _res_constr;
19268         _res_constr.datalen = _res->arr_len;
19269         if (_res_constr.datalen > 0)
19270                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19271         else
19272                 _res_constr.data = NULL;
19273         uint64_t* _res_vals = _res->elems;
19274         for (size_t l = 0; l < _res_constr.datalen; l++) {
19275                 uint64_t _res_conv_11 = _res_vals[l];
19276                 LDKRouteHint _res_conv_11_conv;
19277                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
19278                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
19279                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
19280                 _res_constr.data[l] = _res_conv_11_conv;
19281         }
19282         FREE(_res);
19283         CVec_RouteHintZ_free(_res_constr);
19284 }
19285
19286 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
19287         LDKCVec_RouteHintHopZ _res_constr;
19288         _res_constr.datalen = _res->arr_len;
19289         if (_res_constr.datalen > 0)
19290                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
19291         else
19292                 _res_constr.data = NULL;
19293         uint64_t* _res_vals = _res->elems;
19294         for (size_t o = 0; o < _res_constr.datalen; o++) {
19295                 uint64_t _res_conv_14 = _res_vals[o];
19296                 LDKRouteHintHop _res_conv_14_conv;
19297                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19298                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19299                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19300                 _res_constr.data[o] = _res_conv_14_conv;
19301         }
19302         FREE(_res);
19303         CVec_RouteHintHopZ_free(_res_constr);
19304 }
19305
19306 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
19307         LDKRouteHint o_conv;
19308         o_conv.inner = untag_ptr(o);
19309         o_conv.is_owned = ptr_is_owned(o);
19310         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19311         o_conv = RouteHint_clone(&o_conv);
19312         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19313         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
19314         return tag_ptr(ret_conv, true);
19315 }
19316
19317 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
19318         void* e_ptr = untag_ptr(e);
19319         CHECK_ACCESS(e_ptr);
19320         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19321         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19322         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19323         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
19324         return tag_ptr(ret_conv, true);
19325 }
19326
19327 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
19328         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
19329         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
19330         return ret_conv;
19331 }
19332
19333 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
19334         if (!ptr_is_owned(_res)) return;
19335         void* _res_ptr = untag_ptr(_res);
19336         CHECK_ACCESS(_res_ptr);
19337         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
19338         FREE(untag_ptr(_res));
19339         CResult_RouteHintDecodeErrorZ_free(_res_conv);
19340 }
19341
19342 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
19343         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19344         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
19345         return tag_ptr(ret_conv, true);
19346 }
19347 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
19348         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
19349         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
19350         return ret_conv;
19351 }
19352
19353 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
19354         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
19355         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19356         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
19357         return tag_ptr(ret_conv, true);
19358 }
19359
19360 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
19361         LDKRouteHintHop o_conv;
19362         o_conv.inner = untag_ptr(o);
19363         o_conv.is_owned = ptr_is_owned(o);
19364         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19365         o_conv = RouteHintHop_clone(&o_conv);
19366         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19367         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
19368         return tag_ptr(ret_conv, true);
19369 }
19370
19371 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
19372         void* e_ptr = untag_ptr(e);
19373         CHECK_ACCESS(e_ptr);
19374         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19375         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19376         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19377         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
19378         return tag_ptr(ret_conv, true);
19379 }
19380
19381 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
19382         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
19383         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
19384         return ret_conv;
19385 }
19386
19387 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
19388         if (!ptr_is_owned(_res)) return;
19389         void* _res_ptr = untag_ptr(_res);
19390         CHECK_ACCESS(_res_ptr);
19391         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
19392         FREE(untag_ptr(_res));
19393         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
19394 }
19395
19396 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
19397         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19398         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
19399         return tag_ptr(ret_conv, true);
19400 }
19401 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
19402         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
19403         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
19404         return ret_conv;
19405 }
19406
19407 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
19408         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
19409         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19410         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
19411         return tag_ptr(ret_conv, true);
19412 }
19413
19414 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
19415         LDKFixedPenaltyScorer o_conv;
19416         o_conv.inner = untag_ptr(o);
19417         o_conv.is_owned = ptr_is_owned(o);
19418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19419         o_conv = FixedPenaltyScorer_clone(&o_conv);
19420         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19421         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
19422         return tag_ptr(ret_conv, true);
19423 }
19424
19425 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
19426         void* e_ptr = untag_ptr(e);
19427         CHECK_ACCESS(e_ptr);
19428         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19429         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19430         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19431         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
19432         return tag_ptr(ret_conv, true);
19433 }
19434
19435 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
19436         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
19437         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
19438         return ret_conv;
19439 }
19440
19441 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
19442         if (!ptr_is_owned(_res)) return;
19443         void* _res_ptr = untag_ptr(_res);
19444         CHECK_ACCESS(_res_ptr);
19445         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
19446         FREE(untag_ptr(_res));
19447         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
19448 }
19449
19450 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
19451         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19452         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
19453         return tag_ptr(ret_conv, true);
19454 }
19455 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
19456         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
19457         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
19458         return ret_conv;
19459 }
19460
19461 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
19462         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
19463         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19464         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
19465         return tag_ptr(ret_conv, true);
19466 }
19467
19468 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
19469         LDKCVec_NodeIdZ _res_constr;
19470         _res_constr.datalen = _res->arr_len;
19471         if (_res_constr.datalen > 0)
19472                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
19473         else
19474                 _res_constr.data = NULL;
19475         uint64_t* _res_vals = _res->elems;
19476         for (size_t i = 0; i < _res_constr.datalen; i++) {
19477                 uint64_t _res_conv_8 = _res_vals[i];
19478                 LDKNodeId _res_conv_8_conv;
19479                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
19480                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
19481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
19482                 _res_constr.data[i] = _res_conv_8_conv;
19483         }
19484         FREE(_res);
19485         CVec_NodeIdZ_free(_res_constr);
19486 }
19487
19488 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
19489         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19490         *ret_conv = C2Tuple_u64u64Z_clone(arg);
19491         return tag_ptr(ret_conv, true);
19492 }
19493 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
19494         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
19495         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
19496         return ret_conv;
19497 }
19498
19499 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
19500         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
19501         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19502         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
19503         return tag_ptr(ret_conv, true);
19504 }
19505
19506 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
19507         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19508         *ret_conv = C2Tuple_u64u64Z_new(a, b);
19509         return tag_ptr(ret_conv, true);
19510 }
19511
19512 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
19513         if (!ptr_is_owned(_res)) return;
19514         void* _res_ptr = untag_ptr(_res);
19515         CHECK_ACCESS(_res_ptr);
19516         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
19517         FREE(untag_ptr(_res));
19518         C2Tuple_u64u64Z_free(_res_conv);
19519 }
19520
19521 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
19522         void* o_ptr = untag_ptr(o);
19523         CHECK_ACCESS(o_ptr);
19524         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
19525         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
19526         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19527         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
19528         uint64_t ret_ref = tag_ptr(ret_copy, true);
19529         return ret_ref;
19530 }
19531
19532 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
19533         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19534         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
19535         uint64_t ret_ref = tag_ptr(ret_copy, true);
19536         return ret_ref;
19537 }
19538
19539 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
19540         if (!ptr_is_owned(_res)) return;
19541         void* _res_ptr = untag_ptr(_res);
19542         CHECK_ACCESS(_res_ptr);
19543         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
19544         FREE(untag_ptr(_res));
19545         COption_C2Tuple_u64u64ZZ_free(_res_conv);
19546 }
19547
19548 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
19549         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19550         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
19551         uint64_t ret_ref = tag_ptr(ret_copy, true);
19552         return ret_ref;
19553 }
19554 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
19555         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
19556         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
19557         return ret_conv;
19558 }
19559
19560 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
19561         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
19562         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19563         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
19564         uint64_t ret_ref = tag_ptr(ret_copy, true);
19565         return ret_ref;
19566 }
19567
19568 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
19569         LDKThirtyTwoU16s a_ref;
19570         CHECK(a->arr_len == 32);
19571         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19572         LDKThirtyTwoU16s b_ref;
19573         CHECK(b->arr_len == 32);
19574         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19575         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
19576         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
19577         return tag_ptr(ret_conv, true);
19578 }
19579
19580 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
19581         if (!ptr_is_owned(_res)) return;
19582         void* _res_ptr = untag_ptr(_res);
19583         CHECK_ACCESS(_res_ptr);
19584         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
19585         FREE(untag_ptr(_res));
19586         C2Tuple_Z_free(_res_conv);
19587 }
19588
19589 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
19590         LDKThirtyTwoU16s a_ref;
19591         CHECK(a->arr_len == 32);
19592         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19593         LDKThirtyTwoU16s b_ref;
19594         CHECK(b->arr_len == 32);
19595         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19596         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
19597         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
19598         return tag_ptr(ret_conv, true);
19599 }
19600
19601 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
19602         if (!ptr_is_owned(_res)) return;
19603         void* _res_ptr = untag_ptr(_res);
19604         CHECK_ACCESS(_res_ptr);
19605         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
19606         FREE(untag_ptr(_res));
19607         C2Tuple__u1632_u1632Z_free(_res_conv);
19608 }
19609
19610 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
19611         void* o_ptr = untag_ptr(o);
19612         CHECK_ACCESS(o_ptr);
19613         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
19614         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
19615         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19616         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
19617         uint64_t ret_ref = tag_ptr(ret_copy, true);
19618         return ret_ref;
19619 }
19620
19621 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
19622         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19623         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
19624         uint64_t ret_ref = tag_ptr(ret_copy, true);
19625         return ret_ref;
19626 }
19627
19628 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
19629         if (!ptr_is_owned(_res)) return;
19630         void* _res_ptr = untag_ptr(_res);
19631         CHECK_ACCESS(_res_ptr);
19632         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
19633         FREE(untag_ptr(_res));
19634         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
19635 }
19636
19637 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
19638         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19639         *ret_copy = COption_f64Z_some(o);
19640         uint64_t ret_ref = tag_ptr(ret_copy, true);
19641         return ret_ref;
19642 }
19643
19644 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
19645         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19646         *ret_copy = COption_f64Z_none();
19647         uint64_t ret_ref = tag_ptr(ret_copy, true);
19648         return ret_ref;
19649 }
19650
19651 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
19652         if (!ptr_is_owned(_res)) return;
19653         void* _res_ptr = untag_ptr(_res);
19654         CHECK_ACCESS(_res_ptr);
19655         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
19656         FREE(untag_ptr(_res));
19657         COption_f64Z_free(_res_conv);
19658 }
19659
19660 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
19661         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19662         *ret_copy = COption_f64Z_clone(arg);
19663         uint64_t ret_ref = tag_ptr(ret_copy, true);
19664         return ret_ref;
19665 }
19666 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
19667         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
19668         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
19669         return ret_conv;
19670 }
19671
19672 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
19673         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
19674         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19675         *ret_copy = COption_f64Z_clone(orig_conv);
19676         uint64_t ret_ref = tag_ptr(ret_copy, true);
19677         return ret_ref;
19678 }
19679
19680 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
19681         LDKProbabilisticScorer o_conv;
19682         o_conv.inner = untag_ptr(o);
19683         o_conv.is_owned = ptr_is_owned(o);
19684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19685         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
19686         
19687         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
19688         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
19689         return tag_ptr(ret_conv, true);
19690 }
19691
19692 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
19693         void* e_ptr = untag_ptr(e);
19694         CHECK_ACCESS(e_ptr);
19695         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19696         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19697         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
19698         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
19699         return tag_ptr(ret_conv, true);
19700 }
19701
19702 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
19703         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
19704         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
19705         return ret_conv;
19706 }
19707
19708 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
19709         if (!ptr_is_owned(_res)) return;
19710         void* _res_ptr = untag_ptr(_res);
19711         CHECK_ACCESS(_res_ptr);
19712         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
19713         FREE(untag_ptr(_res));
19714         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
19715 }
19716
19717 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
19718         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
19719         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
19720         return tag_ptr(ret_conv, true);
19721 }
19722 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
19723         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
19724         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
19725         return ret_conv;
19726 }
19727
19728 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
19729         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
19730         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
19731         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
19732         return tag_ptr(ret_conv, true);
19733 }
19734
19735 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
19736         LDKTransaction b_ref;
19737         b_ref.datalen = b->arr_len;
19738         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
19739         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
19740         b_ref.data_is_owned = true;
19741         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
19742         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
19743         return tag_ptr(ret_conv, true);
19744 }
19745
19746 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
19747         if (!ptr_is_owned(_res)) return;
19748         void* _res_ptr = untag_ptr(_res);
19749         CHECK_ACCESS(_res_ptr);
19750         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
19751         FREE(untag_ptr(_res));
19752         C2Tuple_usizeTransactionZ_free(_res_conv);
19753 }
19754
19755 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
19756         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
19757         _res_constr.datalen = _res->arr_len;
19758         if (_res_constr.datalen > 0)
19759                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19760         else
19761                 _res_constr.data = NULL;
19762         uint64_t* _res_vals = _res->elems;
19763         for (size_t c = 0; c < _res_constr.datalen; c++) {
19764                 uint64_t _res_conv_28 = _res_vals[c];
19765                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
19766                 CHECK_ACCESS(_res_conv_28_ptr);
19767                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
19768                 FREE(untag_ptr(_res_conv_28));
19769                 _res_constr.data[c] = _res_conv_28_conv;
19770         }
19771         FREE(_res);
19772         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
19773 }
19774
19775 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
19776         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
19777         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
19778         return tag_ptr(ret_conv, true);
19779 }
19780 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
19781         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
19782         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
19783         return ret_conv;
19784 }
19785
19786 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
19787         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
19788         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
19789         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
19790         return tag_ptr(ret_conv, true);
19791 }
19792
19793 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, uint64_t c) {
19794         LDKThirtyTwoBytes a_ref;
19795         CHECK(a->arr_len == 32);
19796         memcpy(a_ref.data, a->elems, 32); FREE(a);
19797         void* c_ptr = untag_ptr(c);
19798         CHECK_ACCESS(c_ptr);
19799         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
19800         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
19801         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
19802         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
19803         return tag_ptr(ret_conv, true);
19804 }
19805
19806 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(uint64_t _res) {
19807         if (!ptr_is_owned(_res)) return;
19808         void* _res_ptr = untag_ptr(_res);
19809         CHECK_ACCESS(_res_ptr);
19810         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
19811         FREE(untag_ptr(_res));
19812         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
19813 }
19814
19815 void  __attribute__((export_name("TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
19816         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
19817         _res_constr.datalen = _res->arr_len;
19818         if (_res_constr.datalen > 0)
19819                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
19820         else
19821                 _res_constr.data = NULL;
19822         uint64_t* _res_vals = _res->elems;
19823         for (size_t c = 0; c < _res_constr.datalen; c++) {
19824                 uint64_t _res_conv_54 = _res_vals[c];
19825                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
19826                 CHECK_ACCESS(_res_conv_54_ptr);
19827                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
19828                 FREE(untag_ptr(_res_conv_54));
19829                 _res_constr.data[c] = _res_conv_54_conv;
19830         }
19831         FREE(_res);
19832         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
19833 }
19834
19835 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
19836         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
19837         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19838         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
19839         return tag_ptr(ret_conv, true);
19840 }
19841
19842 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
19843         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19844         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
19845         return tag_ptr(ret_conv, true);
19846 }
19847
19848 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
19849         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
19850         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
19851         return ret_conv;
19852 }
19853
19854 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
19855         if (!ptr_is_owned(_res)) return;
19856         void* _res_ptr = untag_ptr(_res);
19857         CHECK_ACCESS(_res_ptr);
19858         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
19859         FREE(untag_ptr(_res));
19860         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
19861 }
19862
19863 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
19864         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19865         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
19866         return tag_ptr(ret_conv, true);
19867 }
19868 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
19869         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
19870         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
19871         return ret_conv;
19872 }
19873
19874 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
19875         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
19876         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19877         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
19878         return tag_ptr(ret_conv, true);
19879 }
19880
19881 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
19882         LDKCVec_MonitorEventZ _res_constr;
19883         _res_constr.datalen = _res->arr_len;
19884         if (_res_constr.datalen > 0)
19885                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
19886         else
19887                 _res_constr.data = NULL;
19888         uint64_t* _res_vals = _res->elems;
19889         for (size_t o = 0; o < _res_constr.datalen; o++) {
19890                 uint64_t _res_conv_14 = _res_vals[o];
19891                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
19892                 CHECK_ACCESS(_res_conv_14_ptr);
19893                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
19894                 FREE(untag_ptr(_res_conv_14));
19895                 _res_constr.data[o] = _res_conv_14_conv;
19896         }
19897         FREE(_res);
19898         CVec_MonitorEventZ_free(_res_constr);
19899 }
19900
19901 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
19902         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
19903         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
19904         return tag_ptr(ret_conv, true);
19905 }
19906 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
19907         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
19908         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
19909         return ret_conv;
19910 }
19911
19912 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
19913         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
19914         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
19915         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
19916         return tag_ptr(ret_conv, true);
19917 }
19918
19919 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
19920         LDKOutPoint a_conv;
19921         a_conv.inner = untag_ptr(a);
19922         a_conv.is_owned = ptr_is_owned(a);
19923         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19924         a_conv = OutPoint_clone(&a_conv);
19925         LDKCVec_MonitorEventZ b_constr;
19926         b_constr.datalen = b->arr_len;
19927         if (b_constr.datalen > 0)
19928                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
19929         else
19930                 b_constr.data = NULL;
19931         uint64_t* b_vals = b->elems;
19932         for (size_t o = 0; o < b_constr.datalen; o++) {
19933                 uint64_t b_conv_14 = b_vals[o];
19934                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
19935                 CHECK_ACCESS(b_conv_14_ptr);
19936                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
19937                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
19938                 b_constr.data[o] = b_conv_14_conv;
19939         }
19940         FREE(b);
19941         LDKPublicKey c_ref;
19942         CHECK(c->arr_len == 33);
19943         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
19944         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
19945         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
19946         return tag_ptr(ret_conv, true);
19947 }
19948
19949 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
19950         if (!ptr_is_owned(_res)) return;
19951         void* _res_ptr = untag_ptr(_res);
19952         CHECK_ACCESS(_res_ptr);
19953         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
19954         FREE(untag_ptr(_res));
19955         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
19956 }
19957
19958 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
19959         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
19960         _res_constr.datalen = _res->arr_len;
19961         if (_res_constr.datalen > 0)
19962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
19963         else
19964                 _res_constr.data = NULL;
19965         uint64_t* _res_vals = _res->elems;
19966         for (size_t x = 0; x < _res_constr.datalen; x++) {
19967                 uint64_t _res_conv_49 = _res_vals[x];
19968                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
19969                 CHECK_ACCESS(_res_conv_49_ptr);
19970                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
19971                 FREE(untag_ptr(_res_conv_49));
19972                 _res_constr.data[x] = _res_conv_49_conv;
19973         }
19974         FREE(_res);
19975         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
19976 }
19977
19978 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
19979         LDKInitFeatures o_conv;
19980         o_conv.inner = untag_ptr(o);
19981         o_conv.is_owned = ptr_is_owned(o);
19982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19983         o_conv = InitFeatures_clone(&o_conv);
19984         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
19985         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
19986         return tag_ptr(ret_conv, true);
19987 }
19988
19989 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
19990         void* e_ptr = untag_ptr(e);
19991         CHECK_ACCESS(e_ptr);
19992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19994         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
19995         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
19996         return tag_ptr(ret_conv, true);
19997 }
19998
19999 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20000         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
20001         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
20002         return ret_conv;
20003 }
20004
20005 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
20006         if (!ptr_is_owned(_res)) return;
20007         void* _res_ptr = untag_ptr(_res);
20008         CHECK_ACCESS(_res_ptr);
20009         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
20010         FREE(untag_ptr(_res));
20011         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
20012 }
20013
20014 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20015         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20016         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
20017         return tag_ptr(ret_conv, true);
20018 }
20019 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20020         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
20021         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20022         return ret_conv;
20023 }
20024
20025 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
20026         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
20027         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20028         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
20029         return tag_ptr(ret_conv, true);
20030 }
20031
20032 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
20033         LDKChannelFeatures o_conv;
20034         o_conv.inner = untag_ptr(o);
20035         o_conv.is_owned = ptr_is_owned(o);
20036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20037         o_conv = ChannelFeatures_clone(&o_conv);
20038         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20039         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
20040         return tag_ptr(ret_conv, true);
20041 }
20042
20043 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
20044         void* e_ptr = untag_ptr(e);
20045         CHECK_ACCESS(e_ptr);
20046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20048         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20049         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
20050         return tag_ptr(ret_conv, true);
20051 }
20052
20053 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20054         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
20055         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
20056         return ret_conv;
20057 }
20058
20059 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
20060         if (!ptr_is_owned(_res)) return;
20061         void* _res_ptr = untag_ptr(_res);
20062         CHECK_ACCESS(_res_ptr);
20063         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
20064         FREE(untag_ptr(_res));
20065         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
20066 }
20067
20068 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20069         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20070         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
20071         return tag_ptr(ret_conv, true);
20072 }
20073 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20074         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
20075         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20076         return ret_conv;
20077 }
20078
20079 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
20080         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
20081         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20082         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
20083         return tag_ptr(ret_conv, true);
20084 }
20085
20086 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
20087         LDKNodeFeatures o_conv;
20088         o_conv.inner = untag_ptr(o);
20089         o_conv.is_owned = ptr_is_owned(o);
20090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20091         o_conv = NodeFeatures_clone(&o_conv);
20092         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20093         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
20094         return tag_ptr(ret_conv, true);
20095 }
20096
20097 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
20098         void* e_ptr = untag_ptr(e);
20099         CHECK_ACCESS(e_ptr);
20100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20102         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20103         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
20104         return tag_ptr(ret_conv, true);
20105 }
20106
20107 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20108         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
20109         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
20110         return ret_conv;
20111 }
20112
20113 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
20114         if (!ptr_is_owned(_res)) return;
20115         void* _res_ptr = untag_ptr(_res);
20116         CHECK_ACCESS(_res_ptr);
20117         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
20118         FREE(untag_ptr(_res));
20119         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
20120 }
20121
20122 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20123         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20124         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
20125         return tag_ptr(ret_conv, true);
20126 }
20127 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20128         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
20129         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20130         return ret_conv;
20131 }
20132
20133 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
20134         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
20135         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20136         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
20137         return tag_ptr(ret_conv, true);
20138 }
20139
20140 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
20141         LDKBolt11InvoiceFeatures o_conv;
20142         o_conv.inner = untag_ptr(o);
20143         o_conv.is_owned = ptr_is_owned(o);
20144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20145         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
20146         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20147         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20148         return tag_ptr(ret_conv, true);
20149 }
20150
20151 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
20152         void* e_ptr = untag_ptr(e);
20153         CHECK_ACCESS(e_ptr);
20154         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20155         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20156         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20157         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
20158         return tag_ptr(ret_conv, true);
20159 }
20160
20161 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20162         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20163         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20164         return ret_conv;
20165 }
20166
20167 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
20168         if (!ptr_is_owned(_res)) return;
20169         void* _res_ptr = untag_ptr(_res);
20170         CHECK_ACCESS(_res_ptr);
20171         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20172         FREE(untag_ptr(_res));
20173         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20174 }
20175
20176 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20177         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20178         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
20179         return tag_ptr(ret_conv, true);
20180 }
20181 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20182         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20183         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20184         return ret_conv;
20185 }
20186
20187 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
20188         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20189         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20190         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20191         return tag_ptr(ret_conv, true);
20192 }
20193
20194 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
20195         LDKBolt12InvoiceFeatures o_conv;
20196         o_conv.inner = untag_ptr(o);
20197         o_conv.is_owned = ptr_is_owned(o);
20198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20199         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
20200         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20201         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20202         return tag_ptr(ret_conv, true);
20203 }
20204
20205 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
20206         void* e_ptr = untag_ptr(e);
20207         CHECK_ACCESS(e_ptr);
20208         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20209         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20210         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20211         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
20212         return tag_ptr(ret_conv, true);
20213 }
20214
20215 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20216         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20217         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20218         return ret_conv;
20219 }
20220
20221 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
20222         if (!ptr_is_owned(_res)) return;
20223         void* _res_ptr = untag_ptr(_res);
20224         CHECK_ACCESS(_res_ptr);
20225         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20226         FREE(untag_ptr(_res));
20227         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20228 }
20229
20230 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20231         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20232         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
20233         return tag_ptr(ret_conv, true);
20234 }
20235 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20236         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20237         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20238         return ret_conv;
20239 }
20240
20241 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
20242         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20243         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20244         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20245         return tag_ptr(ret_conv, true);
20246 }
20247
20248 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
20249         LDKBlindedHopFeatures o_conv;
20250         o_conv.inner = untag_ptr(o);
20251         o_conv.is_owned = ptr_is_owned(o);
20252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20253         o_conv = BlindedHopFeatures_clone(&o_conv);
20254         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20255         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
20256         return tag_ptr(ret_conv, true);
20257 }
20258
20259 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
20260         void* e_ptr = untag_ptr(e);
20261         CHECK_ACCESS(e_ptr);
20262         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20263         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20264         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20265         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
20266         return tag_ptr(ret_conv, true);
20267 }
20268
20269 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20270         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
20271         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
20272         return ret_conv;
20273 }
20274
20275 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
20276         if (!ptr_is_owned(_res)) return;
20277         void* _res_ptr = untag_ptr(_res);
20278         CHECK_ACCESS(_res_ptr);
20279         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
20280         FREE(untag_ptr(_res));
20281         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
20282 }
20283
20284 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20285         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20286         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
20287         return tag_ptr(ret_conv, true);
20288 }
20289 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20290         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
20291         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20292         return ret_conv;
20293 }
20294
20295 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
20296         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
20297         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20298         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
20299         return tag_ptr(ret_conv, true);
20300 }
20301
20302 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
20303         LDKChannelTypeFeatures o_conv;
20304         o_conv.inner = untag_ptr(o);
20305         o_conv.is_owned = ptr_is_owned(o);
20306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20307         o_conv = ChannelTypeFeatures_clone(&o_conv);
20308         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20309         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
20310         return tag_ptr(ret_conv, true);
20311 }
20312
20313 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
20314         void* e_ptr = untag_ptr(e);
20315         CHECK_ACCESS(e_ptr);
20316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20318         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20319         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
20320         return tag_ptr(ret_conv, true);
20321 }
20322
20323 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20324         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
20325         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
20326         return ret_conv;
20327 }
20328
20329 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
20330         if (!ptr_is_owned(_res)) return;
20331         void* _res_ptr = untag_ptr(_res);
20332         CHECK_ACCESS(_res_ptr);
20333         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
20334         FREE(untag_ptr(_res));
20335         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
20336 }
20337
20338 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20339         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20340         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
20341         return tag_ptr(ret_conv, true);
20342 }
20343 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20344         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
20345         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20346         return ret_conv;
20347 }
20348
20349 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
20350         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
20351         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20352         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
20353         return tag_ptr(ret_conv, true);
20354 }
20355
20356 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
20357         LDKOffer o_conv;
20358         o_conv.inner = untag_ptr(o);
20359         o_conv.is_owned = ptr_is_owned(o);
20360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20361         o_conv = Offer_clone(&o_conv);
20362         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20363         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
20364         return tag_ptr(ret_conv, true);
20365 }
20366
20367 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
20368         LDKBolt12ParseError e_conv;
20369         e_conv.inner = untag_ptr(e);
20370         e_conv.is_owned = ptr_is_owned(e);
20371         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20372         e_conv = Bolt12ParseError_clone(&e_conv);
20373         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20374         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
20375         return tag_ptr(ret_conv, true);
20376 }
20377
20378 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
20379         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
20380         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
20381         return ret_conv;
20382 }
20383
20384 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
20385         if (!ptr_is_owned(_res)) return;
20386         void* _res_ptr = untag_ptr(_res);
20387         CHECK_ACCESS(_res_ptr);
20388         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
20389         FREE(untag_ptr(_res));
20390         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
20391 }
20392
20393 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
20394         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20395         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
20396         return tag_ptr(ret_conv, true);
20397 }
20398 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
20399         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
20400         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
20401         return ret_conv;
20402 }
20403
20404 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
20405         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
20406         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20407         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
20408         return tag_ptr(ret_conv, true);
20409 }
20410
20411 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
20412         LDKPublicKey o_ref;
20413         CHECK(o->arr_len == 33);
20414         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
20415         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20416         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
20417         return tag_ptr(ret_conv, true);
20418 }
20419
20420 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
20421         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
20422         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20423         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
20424         return tag_ptr(ret_conv, true);
20425 }
20426
20427 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
20428         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
20429         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
20430         return ret_conv;
20431 }
20432
20433 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
20434         if (!ptr_is_owned(_res)) return;
20435         void* _res_ptr = untag_ptr(_res);
20436         CHECK_ACCESS(_res_ptr);
20437         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
20438         FREE(untag_ptr(_res));
20439         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
20440 }
20441
20442 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
20443         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20444         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
20445         return tag_ptr(ret_conv, true);
20446 }
20447 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
20448         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
20449         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
20450         return ret_conv;
20451 }
20452
20453 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
20454         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
20455         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20456         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
20457         return tag_ptr(ret_conv, true);
20458 }
20459
20460 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
20461         LDKNodeId o_conv;
20462         o_conv.inner = untag_ptr(o);
20463         o_conv.is_owned = ptr_is_owned(o);
20464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20465         o_conv = NodeId_clone(&o_conv);
20466         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20467         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20468         return tag_ptr(ret_conv, true);
20469 }
20470
20471 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
20472         void* e_ptr = untag_ptr(e);
20473         CHECK_ACCESS(e_ptr);
20474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20476         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20477         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20478         return tag_ptr(ret_conv, true);
20479 }
20480
20481 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
20482         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
20483         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20484         return ret_conv;
20485 }
20486
20487 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
20488         if (!ptr_is_owned(_res)) return;
20489         void* _res_ptr = untag_ptr(_res);
20490         CHECK_ACCESS(_res_ptr);
20491         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20492         FREE(untag_ptr(_res));
20493         CResult_NodeIdDecodeErrorZ_free(_res_conv);
20494 }
20495
20496 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20497         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20498         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20499         return tag_ptr(ret_conv, true);
20500 }
20501 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
20502         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
20503         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20504         return ret_conv;
20505 }
20506
20507 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
20508         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
20509         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20510         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20511         return tag_ptr(ret_conv, true);
20512 }
20513
20514 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
20515         void* o_ptr = untag_ptr(o);
20516         CHECK_ACCESS(o_ptr);
20517         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
20518         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
20519         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20520         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
20521         uint64_t ret_ref = tag_ptr(ret_copy, true);
20522         return ret_ref;
20523 }
20524
20525 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
20526         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20527         *ret_copy = COption_NetworkUpdateZ_none();
20528         uint64_t ret_ref = tag_ptr(ret_copy, true);
20529         return ret_ref;
20530 }
20531
20532 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
20533         if (!ptr_is_owned(_res)) return;
20534         void* _res_ptr = untag_ptr(_res);
20535         CHECK_ACCESS(_res_ptr);
20536         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
20537         FREE(untag_ptr(_res));
20538         COption_NetworkUpdateZ_free(_res_conv);
20539 }
20540
20541 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
20542         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20543         *ret_copy = COption_NetworkUpdateZ_clone(arg);
20544         uint64_t ret_ref = tag_ptr(ret_copy, true);
20545         return ret_ref;
20546 }
20547 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
20548         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
20549         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
20550         return ret_conv;
20551 }
20552
20553 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
20554         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
20555         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20556         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
20557         uint64_t ret_ref = tag_ptr(ret_copy, true);
20558         return ret_ref;
20559 }
20560
20561 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
20562         void* o_ptr = untag_ptr(o);
20563         CHECK_ACCESS(o_ptr);
20564         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20565         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
20566         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20567         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20568         return tag_ptr(ret_conv, true);
20569 }
20570
20571 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
20572         void* e_ptr = untag_ptr(e);
20573         CHECK_ACCESS(e_ptr);
20574         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20575         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20576         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20577         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20578         return tag_ptr(ret_conv, true);
20579 }
20580
20581 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
20582         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
20583         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20584         return ret_conv;
20585 }
20586
20587 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
20588         if (!ptr_is_owned(_res)) return;
20589         void* _res_ptr = untag_ptr(_res);
20590         CHECK_ACCESS(_res_ptr);
20591         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20592         FREE(untag_ptr(_res));
20593         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20594 }
20595
20596 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20597         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20598         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20599         return tag_ptr(ret_conv, true);
20600 }
20601 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
20602         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
20603         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20604         return ret_conv;
20605 }
20606
20607 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
20608         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
20609         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20610         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20611         return tag_ptr(ret_conv, true);
20612 }
20613
20614 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
20615         void* o_ptr = untag_ptr(o);
20616         CHECK_ACCESS(o_ptr);
20617         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
20618         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
20619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20620                 LDKUtxoLookup_JCalls_cloned(&o_conv);
20621         }
20622         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20623         *ret_copy = COption_UtxoLookupZ_some(o_conv);
20624         uint64_t ret_ref = tag_ptr(ret_copy, true);
20625         return ret_ref;
20626 }
20627
20628 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
20629         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20630         *ret_copy = COption_UtxoLookupZ_none();
20631         uint64_t ret_ref = tag_ptr(ret_copy, true);
20632         return ret_ref;
20633 }
20634
20635 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
20636         if (!ptr_is_owned(_res)) return;
20637         void* _res_ptr = untag_ptr(_res);
20638         CHECK_ACCESS(_res_ptr);
20639         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
20640         FREE(untag_ptr(_res));
20641         COption_UtxoLookupZ_free(_res_conv);
20642 }
20643
20644 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
20645         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20646         *ret_conv = CResult_NoneLightningErrorZ_ok();
20647         return tag_ptr(ret_conv, true);
20648 }
20649
20650 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
20651         LDKLightningError e_conv;
20652         e_conv.inner = untag_ptr(e);
20653         e_conv.is_owned = ptr_is_owned(e);
20654         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20655         e_conv = LightningError_clone(&e_conv);
20656         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20657         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
20658         return tag_ptr(ret_conv, true);
20659 }
20660
20661 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
20662         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
20663         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
20664         return ret_conv;
20665 }
20666
20667 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
20668         if (!ptr_is_owned(_res)) return;
20669         void* _res_ptr = untag_ptr(_res);
20670         CHECK_ACCESS(_res_ptr);
20671         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
20672         FREE(untag_ptr(_res));
20673         CResult_NoneLightningErrorZ_free(_res_conv);
20674 }
20675
20676 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
20677         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20678         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
20679         return tag_ptr(ret_conv, true);
20680 }
20681 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
20682         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
20683         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
20684         return ret_conv;
20685 }
20686
20687 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
20688         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
20689         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20690         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
20691         return tag_ptr(ret_conv, true);
20692 }
20693
20694 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
20695         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20696         *ret_conv = CResult_boolLightningErrorZ_ok(o);
20697         return tag_ptr(ret_conv, true);
20698 }
20699
20700 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
20701         LDKLightningError e_conv;
20702         e_conv.inner = untag_ptr(e);
20703         e_conv.is_owned = ptr_is_owned(e);
20704         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20705         e_conv = LightningError_clone(&e_conv);
20706         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20707         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
20708         return tag_ptr(ret_conv, true);
20709 }
20710
20711 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
20712         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
20713         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
20714         return ret_conv;
20715 }
20716
20717 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
20718         if (!ptr_is_owned(_res)) return;
20719         void* _res_ptr = untag_ptr(_res);
20720         CHECK_ACCESS(_res_ptr);
20721         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
20722         FREE(untag_ptr(_res));
20723         CResult_boolLightningErrorZ_free(_res_conv);
20724 }
20725
20726 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
20727         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20728         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
20729         return tag_ptr(ret_conv, true);
20730 }
20731 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
20732         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
20733         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
20734         return ret_conv;
20735 }
20736
20737 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
20738         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
20739         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20740         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
20741         return tag_ptr(ret_conv, true);
20742 }
20743
20744 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
20745         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20746         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
20747         return tag_ptr(ret_conv, true);
20748 }
20749 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
20750         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
20751         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
20752         return ret_conv;
20753 }
20754
20755 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
20756         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
20757         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20758         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
20759         return tag_ptr(ret_conv, true);
20760 }
20761
20762 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
20763         LDKChannelAnnouncement a_conv;
20764         a_conv.inner = untag_ptr(a);
20765         a_conv.is_owned = ptr_is_owned(a);
20766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20767         a_conv = ChannelAnnouncement_clone(&a_conv);
20768         LDKChannelUpdate b_conv;
20769         b_conv.inner = untag_ptr(b);
20770         b_conv.is_owned = ptr_is_owned(b);
20771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20772         b_conv = ChannelUpdate_clone(&b_conv);
20773         LDKChannelUpdate c_conv;
20774         c_conv.inner = untag_ptr(c);
20775         c_conv.is_owned = ptr_is_owned(c);
20776         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20777         c_conv = ChannelUpdate_clone(&c_conv);
20778         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20779         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
20780         return tag_ptr(ret_conv, true);
20781 }
20782
20783 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
20784         if (!ptr_is_owned(_res)) return;
20785         void* _res_ptr = untag_ptr(_res);
20786         CHECK_ACCESS(_res_ptr);
20787         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
20788         FREE(untag_ptr(_res));
20789         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
20790 }
20791
20792 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
20793         void* o_ptr = untag_ptr(o);
20794         CHECK_ACCESS(o_ptr);
20795         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
20796         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
20797         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20798         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
20799         uint64_t ret_ref = tag_ptr(ret_copy, true);
20800         return ret_ref;
20801 }
20802
20803 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
20804         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20805         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
20806         uint64_t ret_ref = tag_ptr(ret_copy, true);
20807         return ret_ref;
20808 }
20809
20810 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
20811         if (!ptr_is_owned(_res)) return;
20812         void* _res_ptr = untag_ptr(_res);
20813         CHECK_ACCESS(_res_ptr);
20814         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
20815         FREE(untag_ptr(_res));
20816         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
20817 }
20818
20819 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
20820         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20821         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
20822         uint64_t ret_ref = tag_ptr(ret_copy, true);
20823         return ret_ref;
20824 }
20825 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
20826         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
20827         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
20828         return ret_conv;
20829 }
20830
20831 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
20832         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
20833         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20834         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
20835         uint64_t ret_ref = tag_ptr(ret_copy, true);
20836         return ret_ref;
20837 }
20838
20839 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
20840         LDKCVec_MessageSendEventZ _res_constr;
20841         _res_constr.datalen = _res->arr_len;
20842         if (_res_constr.datalen > 0)
20843                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
20844         else
20845                 _res_constr.data = NULL;
20846         uint64_t* _res_vals = _res->elems;
20847         for (size_t s = 0; s < _res_constr.datalen; s++) {
20848                 uint64_t _res_conv_18 = _res_vals[s];
20849                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
20850                 CHECK_ACCESS(_res_conv_18_ptr);
20851                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
20852                 FREE(untag_ptr(_res_conv_18));
20853                 _res_constr.data[s] = _res_conv_18_conv;
20854         }
20855         FREE(_res);
20856         CVec_MessageSendEventZ_free(_res_constr);
20857 }
20858
20859 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
20860         LDKChannelUpdateInfo o_conv;
20861         o_conv.inner = untag_ptr(o);
20862         o_conv.is_owned = ptr_is_owned(o);
20863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20864         o_conv = ChannelUpdateInfo_clone(&o_conv);
20865         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20866         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
20867         return tag_ptr(ret_conv, true);
20868 }
20869
20870 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
20871         void* e_ptr = untag_ptr(e);
20872         CHECK_ACCESS(e_ptr);
20873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20875         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20876         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
20877         return tag_ptr(ret_conv, true);
20878 }
20879
20880 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
20881         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
20882         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
20883         return ret_conv;
20884 }
20885
20886 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
20887         if (!ptr_is_owned(_res)) return;
20888         void* _res_ptr = untag_ptr(_res);
20889         CHECK_ACCESS(_res_ptr);
20890         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
20891         FREE(untag_ptr(_res));
20892         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
20893 }
20894
20895 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
20896         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20897         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
20898         return tag_ptr(ret_conv, true);
20899 }
20900 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20901         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
20902         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
20903         return ret_conv;
20904 }
20905
20906 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
20907         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
20908         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20909         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
20910         return tag_ptr(ret_conv, true);
20911 }
20912
20913 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
20914         LDKChannelInfo o_conv;
20915         o_conv.inner = untag_ptr(o);
20916         o_conv.is_owned = ptr_is_owned(o);
20917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20918         o_conv = ChannelInfo_clone(&o_conv);
20919         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20920         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
20921         return tag_ptr(ret_conv, true);
20922 }
20923
20924 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
20925         void* e_ptr = untag_ptr(e);
20926         CHECK_ACCESS(e_ptr);
20927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20929         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20930         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
20931         return tag_ptr(ret_conv, true);
20932 }
20933
20934 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
20935         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
20936         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
20937         return ret_conv;
20938 }
20939
20940 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
20941         if (!ptr_is_owned(_res)) return;
20942         void* _res_ptr = untag_ptr(_res);
20943         CHECK_ACCESS(_res_ptr);
20944         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
20945         FREE(untag_ptr(_res));
20946         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
20947 }
20948
20949 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
20950         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20951         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
20952         return tag_ptr(ret_conv, true);
20953 }
20954 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20955         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
20956         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
20957         return ret_conv;
20958 }
20959
20960 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
20961         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
20962         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20963         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
20964         return tag_ptr(ret_conv, true);
20965 }
20966
20967 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
20968         LDKRoutingFees o_conv;
20969         o_conv.inner = untag_ptr(o);
20970         o_conv.is_owned = ptr_is_owned(o);
20971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20972         o_conv = RoutingFees_clone(&o_conv);
20973         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20974         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
20975         return tag_ptr(ret_conv, true);
20976 }
20977
20978 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
20979         void* e_ptr = untag_ptr(e);
20980         CHECK_ACCESS(e_ptr);
20981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20983         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20984         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
20985         return tag_ptr(ret_conv, true);
20986 }
20987
20988 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
20989         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
20990         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
20991         return ret_conv;
20992 }
20993
20994 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
20995         if (!ptr_is_owned(_res)) return;
20996         void* _res_ptr = untag_ptr(_res);
20997         CHECK_ACCESS(_res_ptr);
20998         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
20999         FREE(untag_ptr(_res));
21000         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
21001 }
21002
21003 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
21004         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21005         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
21006         return tag_ptr(ret_conv, true);
21007 }
21008 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
21009         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
21010         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
21011         return ret_conv;
21012 }
21013
21014 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
21015         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
21016         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21017         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
21018         return tag_ptr(ret_conv, true);
21019 }
21020
21021 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
21022         LDKCVec_SocketAddressZ _res_constr;
21023         _res_constr.datalen = _res->arr_len;
21024         if (_res_constr.datalen > 0)
21025                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21026         else
21027                 _res_constr.data = NULL;
21028         uint64_t* _res_vals = _res->elems;
21029         for (size_t p = 0; p < _res_constr.datalen; p++) {
21030                 uint64_t _res_conv_15 = _res_vals[p];
21031                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
21032                 CHECK_ACCESS(_res_conv_15_ptr);
21033                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
21034                 FREE(untag_ptr(_res_conv_15));
21035                 _res_constr.data[p] = _res_conv_15_conv;
21036         }
21037         FREE(_res);
21038         CVec_SocketAddressZ_free(_res_constr);
21039 }
21040
21041 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
21042         LDKNodeAnnouncementInfo o_conv;
21043         o_conv.inner = untag_ptr(o);
21044         o_conv.is_owned = ptr_is_owned(o);
21045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21046         o_conv = NodeAnnouncementInfo_clone(&o_conv);
21047         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21048         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
21049         return tag_ptr(ret_conv, true);
21050 }
21051
21052 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
21053         void* e_ptr = untag_ptr(e);
21054         CHECK_ACCESS(e_ptr);
21055         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21056         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21057         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21058         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
21059         return tag_ptr(ret_conv, true);
21060 }
21061
21062 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
21063         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
21064         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
21065         return ret_conv;
21066 }
21067
21068 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
21069         if (!ptr_is_owned(_res)) return;
21070         void* _res_ptr = untag_ptr(_res);
21071         CHECK_ACCESS(_res_ptr);
21072         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
21073         FREE(untag_ptr(_res));
21074         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
21075 }
21076
21077 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
21078         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21079         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
21080         return tag_ptr(ret_conv, true);
21081 }
21082 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21083         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
21084         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
21085         return ret_conv;
21086 }
21087
21088 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
21089         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
21090         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21091         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
21092         return tag_ptr(ret_conv, true);
21093 }
21094
21095 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
21096         LDKNodeAlias o_conv;
21097         o_conv.inner = untag_ptr(o);
21098         o_conv.is_owned = ptr_is_owned(o);
21099         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21100         o_conv = NodeAlias_clone(&o_conv);
21101         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21102         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
21103         return tag_ptr(ret_conv, true);
21104 }
21105
21106 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
21107         void* e_ptr = untag_ptr(e);
21108         CHECK_ACCESS(e_ptr);
21109         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21110         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21111         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21112         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
21113         return tag_ptr(ret_conv, true);
21114 }
21115
21116 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
21117         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
21118         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
21119         return ret_conv;
21120 }
21121
21122 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
21123         if (!ptr_is_owned(_res)) return;
21124         void* _res_ptr = untag_ptr(_res);
21125         CHECK_ACCESS(_res_ptr);
21126         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
21127         FREE(untag_ptr(_res));
21128         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
21129 }
21130
21131 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
21132         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21133         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
21134         return tag_ptr(ret_conv, true);
21135 }
21136 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
21137         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
21138         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
21139         return ret_conv;
21140 }
21141
21142 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
21143         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
21144         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21145         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
21146         return tag_ptr(ret_conv, true);
21147 }
21148
21149 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
21150         LDKNodeInfo o_conv;
21151         o_conv.inner = untag_ptr(o);
21152         o_conv.is_owned = ptr_is_owned(o);
21153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21154         o_conv = NodeInfo_clone(&o_conv);
21155         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21156         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
21157         return tag_ptr(ret_conv, true);
21158 }
21159
21160 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
21161         void* e_ptr = untag_ptr(e);
21162         CHECK_ACCESS(e_ptr);
21163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21165         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21166         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
21167         return tag_ptr(ret_conv, true);
21168 }
21169
21170 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
21171         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
21172         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
21173         return ret_conv;
21174 }
21175
21176 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
21177         if (!ptr_is_owned(_res)) return;
21178         void* _res_ptr = untag_ptr(_res);
21179         CHECK_ACCESS(_res_ptr);
21180         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
21181         FREE(untag_ptr(_res));
21182         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
21183 }
21184
21185 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
21186         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21187         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
21188         return tag_ptr(ret_conv, true);
21189 }
21190 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21191         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
21192         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
21193         return ret_conv;
21194 }
21195
21196 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
21197         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
21198         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21199         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
21200         return tag_ptr(ret_conv, true);
21201 }
21202
21203 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
21204         LDKNetworkGraph o_conv;
21205         o_conv.inner = untag_ptr(o);
21206         o_conv.is_owned = ptr_is_owned(o);
21207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21208         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
21209         
21210         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21211         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
21212         return tag_ptr(ret_conv, true);
21213 }
21214
21215 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
21216         void* e_ptr = untag_ptr(e);
21217         CHECK_ACCESS(e_ptr);
21218         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21219         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21220         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21221         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
21222         return tag_ptr(ret_conv, true);
21223 }
21224
21225 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
21226         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
21227         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
21228         return ret_conv;
21229 }
21230
21231 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
21232         if (!ptr_is_owned(_res)) return;
21233         void* _res_ptr = untag_ptr(_res);
21234         CHECK_ACCESS(_res_ptr);
21235         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
21236         FREE(untag_ptr(_res));
21237         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
21238 }
21239
21240 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
21241         LDKCVec_SocketAddressZ o_constr;
21242         o_constr.datalen = o->arr_len;
21243         if (o_constr.datalen > 0)
21244                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21245         else
21246                 o_constr.data = NULL;
21247         uint64_t* o_vals = o->elems;
21248         for (size_t p = 0; p < o_constr.datalen; p++) {
21249                 uint64_t o_conv_15 = o_vals[p];
21250                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
21251                 CHECK_ACCESS(o_conv_15_ptr);
21252                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
21253                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
21254                 o_constr.data[p] = o_conv_15_conv;
21255         }
21256         FREE(o);
21257         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21258         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
21259         uint64_t ret_ref = tag_ptr(ret_copy, true);
21260         return ret_ref;
21261 }
21262
21263 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
21264         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21265         *ret_copy = COption_CVec_SocketAddressZZ_none();
21266         uint64_t ret_ref = tag_ptr(ret_copy, true);
21267         return ret_ref;
21268 }
21269
21270 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
21271         if (!ptr_is_owned(_res)) return;
21272         void* _res_ptr = untag_ptr(_res);
21273         CHECK_ACCESS(_res_ptr);
21274         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
21275         FREE(untag_ptr(_res));
21276         COption_CVec_SocketAddressZZ_free(_res_conv);
21277 }
21278
21279 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
21280         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21281         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
21282         uint64_t ret_ref = tag_ptr(ret_copy, true);
21283         return ret_ref;
21284 }
21285 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
21286         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
21287         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
21288         return ret_conv;
21289 }
21290
21291 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
21292         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
21293         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21294         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
21295         uint64_t ret_ref = tag_ptr(ret_copy, true);
21296         return ret_ref;
21297 }
21298
21299 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(uint64_t o) {
21300         LDKPendingHTLCInfo o_conv;
21301         o_conv.inner = untag_ptr(o);
21302         o_conv.is_owned = ptr_is_owned(o);
21303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21304         o_conv = PendingHTLCInfo_clone(&o_conv);
21305         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21306         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
21307         return tag_ptr(ret_conv, true);
21308 }
21309
21310 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err(uint64_t e) {
21311         LDKInboundHTLCErr e_conv;
21312         e_conv.inner = untag_ptr(e);
21313         e_conv.is_owned = ptr_is_owned(e);
21314         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21315         // WARNING: we need a move here but no clone is available for LDKInboundHTLCErr
21316         
21317         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21318         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
21319         return tag_ptr(ret_conv, true);
21320 }
21321
21322 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(uint64_t o) {
21323         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
21324         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
21325         return ret_conv;
21326 }
21327
21328 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free(uint64_t _res) {
21329         if (!ptr_is_owned(_res)) return;
21330         void* _res_ptr = untag_ptr(_res);
21331         CHECK_ACCESS(_res_ptr);
21332         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
21333         FREE(untag_ptr(_res));
21334         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
21335 }
21336
21337 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
21338         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
21339         _res_constr.datalen = _res->arr_len;
21340         if (_res_constr.datalen > 0)
21341                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
21342         else
21343                 _res_constr.data = NULL;
21344         uint64_t* _res_vals = _res->elems;
21345         for (size_t y = 0; y < _res_constr.datalen; y++) {
21346                 uint64_t _res_conv_24 = _res_vals[y];
21347                 LDKHTLCOutputInCommitment _res_conv_24_conv;
21348                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
21349                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
21350                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
21351                 _res_constr.data[y] = _res_conv_24_conv;
21352         }
21353         FREE(_res);
21354         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
21355 }
21356
21357 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
21358         LDKCVec_HTLCDescriptorZ _res_constr;
21359         _res_constr.datalen = _res->arr_len;
21360         if (_res_constr.datalen > 0)
21361                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
21362         else
21363                 _res_constr.data = NULL;
21364         uint64_t* _res_vals = _res->elems;
21365         for (size_t q = 0; q < _res_constr.datalen; q++) {
21366                 uint64_t _res_conv_16 = _res_vals[q];
21367                 LDKHTLCDescriptor _res_conv_16_conv;
21368                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21369                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21370                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21371                 _res_constr.data[q] = _res_conv_16_conv;
21372         }
21373         FREE(_res);
21374         CVec_HTLCDescriptorZ_free(_res_constr);
21375 }
21376
21377 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
21378         LDKCVec_UtxoZ _res_constr;
21379         _res_constr.datalen = _res->arr_len;
21380         if (_res_constr.datalen > 0)
21381                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21382         else
21383                 _res_constr.data = NULL;
21384         uint64_t* _res_vals = _res->elems;
21385         for (size_t g = 0; g < _res_constr.datalen; g++) {
21386                 uint64_t _res_conv_6 = _res_vals[g];
21387                 LDKUtxo _res_conv_6_conv;
21388                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21389                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21390                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21391                 _res_constr.data[g] = _res_conv_6_conv;
21392         }
21393         FREE(_res);
21394         CVec_UtxoZ_free(_res_constr);
21395 }
21396
21397 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
21398         void* o_ptr = untag_ptr(o);
21399         CHECK_ACCESS(o_ptr);
21400         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
21401         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
21402         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21403         *ret_copy = COption_TxOutZ_some(o_conv);
21404         uint64_t ret_ref = tag_ptr(ret_copy, true);
21405         return ret_ref;
21406 }
21407
21408 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
21409         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21410         *ret_copy = COption_TxOutZ_none();
21411         uint64_t ret_ref = tag_ptr(ret_copy, true);
21412         return ret_ref;
21413 }
21414
21415 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
21416         if (!ptr_is_owned(_res)) return;
21417         void* _res_ptr = untag_ptr(_res);
21418         CHECK_ACCESS(_res_ptr);
21419         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
21420         FREE(untag_ptr(_res));
21421         COption_TxOutZ_free(_res_conv);
21422 }
21423
21424 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
21425         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21426         *ret_copy = COption_TxOutZ_clone(arg);
21427         uint64_t ret_ref = tag_ptr(ret_copy, true);
21428         return ret_ref;
21429 }
21430 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
21431         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
21432         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
21433         return ret_conv;
21434 }
21435
21436 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
21437         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
21438         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21439         *ret_copy = COption_TxOutZ_clone(orig_conv);
21440         uint64_t ret_ref = tag_ptr(ret_copy, true);
21441         return ret_ref;
21442 }
21443
21444 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
21445         LDKCVec_InputZ _res_constr;
21446         _res_constr.datalen = _res->arr_len;
21447         if (_res_constr.datalen > 0)
21448                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
21449         else
21450                 _res_constr.data = NULL;
21451         uint64_t* _res_vals = _res->elems;
21452         for (size_t h = 0; h < _res_constr.datalen; h++) {
21453                 uint64_t _res_conv_7 = _res_vals[h];
21454                 LDKInput _res_conv_7_conv;
21455                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
21456                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
21457                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
21458                 _res_constr.data[h] = _res_conv_7_conv;
21459         }
21460         FREE(_res);
21461         CVec_InputZ_free(_res_constr);
21462 }
21463
21464 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
21465         LDKCoinSelection o_conv;
21466         o_conv.inner = untag_ptr(o);
21467         o_conv.is_owned = ptr_is_owned(o);
21468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21469         o_conv = CoinSelection_clone(&o_conv);
21470         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21471         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
21472         return tag_ptr(ret_conv, true);
21473 }
21474
21475 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
21476         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21477         *ret_conv = CResult_CoinSelectionNoneZ_err();
21478         return tag_ptr(ret_conv, true);
21479 }
21480
21481 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
21482         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
21483         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
21484         return ret_conv;
21485 }
21486
21487 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
21488         if (!ptr_is_owned(_res)) return;
21489         void* _res_ptr = untag_ptr(_res);
21490         CHECK_ACCESS(_res_ptr);
21491         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
21492         FREE(untag_ptr(_res));
21493         CResult_CoinSelectionNoneZ_free(_res_conv);
21494 }
21495
21496 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
21497         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21498         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
21499         return tag_ptr(ret_conv, true);
21500 }
21501 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
21502         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
21503         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
21504         return ret_conv;
21505 }
21506
21507 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
21508         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
21509         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21510         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
21511         return tag_ptr(ret_conv, true);
21512 }
21513
21514 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
21515         LDKCVec_UtxoZ o_constr;
21516         o_constr.datalen = o->arr_len;
21517         if (o_constr.datalen > 0)
21518                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21519         else
21520                 o_constr.data = NULL;
21521         uint64_t* o_vals = o->elems;
21522         for (size_t g = 0; g < o_constr.datalen; g++) {
21523                 uint64_t o_conv_6 = o_vals[g];
21524                 LDKUtxo o_conv_6_conv;
21525                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
21526                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
21527                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
21528                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
21529                 o_constr.data[g] = o_conv_6_conv;
21530         }
21531         FREE(o);
21532         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21533         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
21534         return tag_ptr(ret_conv, true);
21535 }
21536
21537 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
21538         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21539         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
21540         return tag_ptr(ret_conv, true);
21541 }
21542
21543 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
21544         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
21545         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
21546         return ret_conv;
21547 }
21548
21549 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
21550         if (!ptr_is_owned(_res)) return;
21551         void* _res_ptr = untag_ptr(_res);
21552         CHECK_ACCESS(_res_ptr);
21553         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
21554         FREE(untag_ptr(_res));
21555         CResult_CVec_UtxoZNoneZ_free(_res_conv);
21556 }
21557
21558 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
21559         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21560         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
21561         return tag_ptr(ret_conv, true);
21562 }
21563 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
21564         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
21565         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
21566         return ret_conv;
21567 }
21568
21569 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
21570         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
21571         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21572         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
21573         return tag_ptr(ret_conv, true);
21574 }
21575
21576 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
21577         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21578         *ret_conv = C2Tuple_u64u16Z_clone(arg);
21579         return tag_ptr(ret_conv, true);
21580 }
21581 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
21582         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
21583         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
21584         return ret_conv;
21585 }
21586
21587 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
21588         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
21589         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21590         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
21591         return tag_ptr(ret_conv, true);
21592 }
21593
21594 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
21595         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21596         *ret_conv = C2Tuple_u64u16Z_new(a, b);
21597         return tag_ptr(ret_conv, true);
21598 }
21599
21600 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
21601         if (!ptr_is_owned(_res)) return;
21602         void* _res_ptr = untag_ptr(_res);
21603         CHECK_ACCESS(_res_ptr);
21604         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
21605         FREE(untag_ptr(_res));
21606         C2Tuple_u64u16Z_free(_res_conv);
21607 }
21608
21609 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
21610         void* o_ptr = untag_ptr(o);
21611         CHECK_ACCESS(o_ptr);
21612         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
21613         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
21614         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21615         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
21616         uint64_t ret_ref = tag_ptr(ret_copy, true);
21617         return ret_ref;
21618 }
21619
21620 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
21621         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21622         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
21623         uint64_t ret_ref = tag_ptr(ret_copy, true);
21624         return ret_ref;
21625 }
21626
21627 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
21628         if (!ptr_is_owned(_res)) return;
21629         void* _res_ptr = untag_ptr(_res);
21630         CHECK_ACCESS(_res_ptr);
21631         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
21632         FREE(untag_ptr(_res));
21633         COption_C2Tuple_u64u16ZZ_free(_res_conv);
21634 }
21635
21636 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
21637         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21638         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
21639         uint64_t ret_ref = tag_ptr(ret_copy, true);
21640         return ret_ref;
21641 }
21642 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
21643         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
21644         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
21645         return ret_conv;
21646 }
21647
21648 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
21649         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
21650         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21651         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
21652         uint64_t ret_ref = tag_ptr(ret_copy, true);
21653         return ret_ref;
21654 }
21655
21656 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
21657         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
21658         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21659         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
21660         uint64_t ret_ref = tag_ptr(ret_copy, true);
21661         return ret_ref;
21662 }
21663
21664 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
21665         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21666         *ret_copy = COption_ChannelShutdownStateZ_none();
21667         uint64_t ret_ref = tag_ptr(ret_copy, true);
21668         return ret_ref;
21669 }
21670
21671 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
21672         if (!ptr_is_owned(_res)) return;
21673         void* _res_ptr = untag_ptr(_res);
21674         CHECK_ACCESS(_res_ptr);
21675         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
21676         FREE(untag_ptr(_res));
21677         COption_ChannelShutdownStateZ_free(_res_conv);
21678 }
21679
21680 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
21681         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21682         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
21683         uint64_t ret_ref = tag_ptr(ret_copy, true);
21684         return ret_ref;
21685 }
21686 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
21687         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
21688         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
21689         return ret_conv;
21690 }
21691
21692 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
21693         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
21694         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21695         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
21696         uint64_t ret_ref = tag_ptr(ret_copy, true);
21697         return ret_ref;
21698 }
21699
21700 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
21701         LDKThirtyTwoBytes o_ref;
21702         CHECK(o->arr_len == 32);
21703         memcpy(o_ref.data, o->elems, 32); FREE(o);
21704         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21705         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
21706         return tag_ptr(ret_conv, true);
21707 }
21708
21709 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
21710         void* e_ptr = untag_ptr(e);
21711         CHECK_ACCESS(e_ptr);
21712         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21713         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21714         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21715         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
21716         return tag_ptr(ret_conv, true);
21717 }
21718
21719 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
21720         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
21721         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
21722         return ret_conv;
21723 }
21724
21725 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
21726         if (!ptr_is_owned(_res)) return;
21727         void* _res_ptr = untag_ptr(_res);
21728         CHECK_ACCESS(_res_ptr);
21729         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
21730         FREE(untag_ptr(_res));
21731         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
21732 }
21733
21734 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
21735         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21736         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
21737         return tag_ptr(ret_conv, true);
21738 }
21739 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
21740         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
21741         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
21742         return ret_conv;
21743 }
21744
21745 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
21746         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
21747         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21748         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
21749         return tag_ptr(ret_conv, true);
21750 }
21751
21752 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
21753         LDKCVec_RecentPaymentDetailsZ _res_constr;
21754         _res_constr.datalen = _res->arr_len;
21755         if (_res_constr.datalen > 0)
21756                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
21757         else
21758                 _res_constr.data = NULL;
21759         uint64_t* _res_vals = _res->elems;
21760         for (size_t w = 0; w < _res_constr.datalen; w++) {
21761                 uint64_t _res_conv_22 = _res_vals[w];
21762                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
21763                 CHECK_ACCESS(_res_conv_22_ptr);
21764                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
21765                 FREE(untag_ptr(_res_conv_22));
21766                 _res_constr.data[w] = _res_conv_22_conv;
21767         }
21768         FREE(_res);
21769         CVec_RecentPaymentDetailsZ_free(_res_constr);
21770 }
21771
21772 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
21773         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21774         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
21775         return tag_ptr(ret_conv, true);
21776 }
21777
21778 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
21779         void* e_ptr = untag_ptr(e);
21780         CHECK_ACCESS(e_ptr);
21781         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
21782         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
21783         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21784         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
21785         return tag_ptr(ret_conv, true);
21786 }
21787
21788 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
21789         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
21790         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
21791         return ret_conv;
21792 }
21793
21794 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
21795         if (!ptr_is_owned(_res)) return;
21796         void* _res_ptr = untag_ptr(_res);
21797         CHECK_ACCESS(_res_ptr);
21798         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
21799         FREE(untag_ptr(_res));
21800         CResult_NonePaymentSendFailureZ_free(_res_conv);
21801 }
21802
21803 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
21804         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21805         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
21806         return tag_ptr(ret_conv, true);
21807 }
21808 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
21809         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
21810         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
21811         return ret_conv;
21812 }
21813
21814 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
21815         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
21816         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21817         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
21818         return tag_ptr(ret_conv, true);
21819 }
21820
21821 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
21822         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21823         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
21824         return tag_ptr(ret_conv, true);
21825 }
21826
21827 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
21828         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
21829         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21830         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
21831         return tag_ptr(ret_conv, true);
21832 }
21833
21834 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
21835         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
21836         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
21837         return ret_conv;
21838 }
21839
21840 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
21841         if (!ptr_is_owned(_res)) return;
21842         void* _res_ptr = untag_ptr(_res);
21843         CHECK_ACCESS(_res_ptr);
21844         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
21845         FREE(untag_ptr(_res));
21846         CResult_NoneRetryableSendFailureZ_free(_res_conv);
21847 }
21848
21849 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
21850         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21851         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
21852         return tag_ptr(ret_conv, true);
21853 }
21854 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
21855         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
21856         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
21857         return ret_conv;
21858 }
21859
21860 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
21861         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
21862         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21863         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
21864         return tag_ptr(ret_conv, true);
21865 }
21866
21867 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
21868         LDKThirtyTwoBytes o_ref;
21869         CHECK(o->arr_len == 32);
21870         memcpy(o_ref.data, o->elems, 32); FREE(o);
21871         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21872         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
21873         return tag_ptr(ret_conv, true);
21874 }
21875
21876 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
21877         void* e_ptr = untag_ptr(e);
21878         CHECK_ACCESS(e_ptr);
21879         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
21880         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
21881         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21882         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
21883         return tag_ptr(ret_conv, true);
21884 }
21885
21886 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
21887         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
21888         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
21889         return ret_conv;
21890 }
21891
21892 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
21893         if (!ptr_is_owned(_res)) return;
21894         void* _res_ptr = untag_ptr(_res);
21895         CHECK_ACCESS(_res_ptr);
21896         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
21897         FREE(untag_ptr(_res));
21898         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
21899 }
21900
21901 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
21902         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21903         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
21904         return tag_ptr(ret_conv, true);
21905 }
21906 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
21907         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
21908         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
21909         return ret_conv;
21910 }
21911
21912 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
21913         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
21914         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21915         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
21916         return tag_ptr(ret_conv, true);
21917 }
21918
21919 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
21920         LDKThirtyTwoBytes o_ref;
21921         CHECK(o->arr_len == 32);
21922         memcpy(o_ref.data, o->elems, 32); FREE(o);
21923         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21924         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
21925         return tag_ptr(ret_conv, true);
21926 }
21927
21928 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
21929         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
21930         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21931         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
21932         return tag_ptr(ret_conv, true);
21933 }
21934
21935 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
21936         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
21937         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
21938         return ret_conv;
21939 }
21940
21941 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
21942         if (!ptr_is_owned(_res)) return;
21943         void* _res_ptr = untag_ptr(_res);
21944         CHECK_ACCESS(_res_ptr);
21945         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
21946         FREE(untag_ptr(_res));
21947         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
21948 }
21949
21950 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
21951         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21952         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
21953         return tag_ptr(ret_conv, true);
21954 }
21955 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
21956         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
21957         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
21958         return ret_conv;
21959 }
21960
21961 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
21962         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
21963         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21964         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
21965         return tag_ptr(ret_conv, true);
21966 }
21967
21968 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
21969         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
21970         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
21971         return tag_ptr(ret_conv, true);
21972 }
21973 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
21974         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
21975         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
21976         return ret_conv;
21977 }
21978
21979 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
21980         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
21981         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
21982         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
21983         return tag_ptr(ret_conv, true);
21984 }
21985
21986 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
21987         LDKThirtyTwoBytes a_ref;
21988         CHECK(a->arr_len == 32);
21989         memcpy(a_ref.data, a->elems, 32); FREE(a);
21990         LDKThirtyTwoBytes b_ref;
21991         CHECK(b->arr_len == 32);
21992         memcpy(b_ref.data, b->elems, 32); FREE(b);
21993         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
21994         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
21995         return tag_ptr(ret_conv, true);
21996 }
21997
21998 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
21999         if (!ptr_is_owned(_res)) return;
22000         void* _res_ptr = untag_ptr(_res);
22001         CHECK_ACCESS(_res_ptr);
22002         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
22003         FREE(untag_ptr(_res));
22004         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
22005 }
22006
22007 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
22008         void* o_ptr = untag_ptr(o);
22009         CHECK_ACCESS(o_ptr);
22010         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22011         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22012         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22013         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
22014         return tag_ptr(ret_conv, true);
22015 }
22016
22017 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
22018         void* e_ptr = untag_ptr(e);
22019         CHECK_ACCESS(e_ptr);
22020         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22021         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22022         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22023         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
22024         return tag_ptr(ret_conv, true);
22025 }
22026
22027 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
22028         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
22029         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
22030         return ret_conv;
22031 }
22032
22033 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
22034         if (!ptr_is_owned(_res)) return;
22035         void* _res_ptr = untag_ptr(_res);
22036         CHECK_ACCESS(_res_ptr);
22037         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
22038         FREE(untag_ptr(_res));
22039         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
22040 }
22041
22042 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
22043         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22044         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
22045         return tag_ptr(ret_conv, true);
22046 }
22047 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
22048         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
22049         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
22050         return ret_conv;
22051 }
22052
22053 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
22054         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
22055         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22056         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
22057         return tag_ptr(ret_conv, true);
22058 }
22059
22060 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
22061         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
22062         _res_constr.datalen = _res->arr_len;
22063         if (_res_constr.datalen > 0)
22064                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22065         else
22066                 _res_constr.data = NULL;
22067         uint64_t* _res_vals = _res->elems;
22068         for (size_t o = 0; o < _res_constr.datalen; o++) {
22069                 uint64_t _res_conv_40 = _res_vals[o];
22070                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22071                 CHECK_ACCESS(_res_conv_40_ptr);
22072                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
22073                 FREE(untag_ptr(_res_conv_40));
22074                 _res_constr.data[o] = _res_conv_40_conv;
22075         }
22076         FREE(_res);
22077         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
22078 }
22079
22080 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
22081         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
22082         o_constr.datalen = o->arr_len;
22083         if (o_constr.datalen > 0)
22084                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22085         else
22086                 o_constr.data = NULL;
22087         uint64_t* o_vals = o->elems;
22088         for (size_t o = 0; o < o_constr.datalen; o++) {
22089                 uint64_t o_conv_40 = o_vals[o];
22090                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
22091                 CHECK_ACCESS(o_conv_40_ptr);
22092                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
22093                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
22094                 o_constr.data[o] = o_conv_40_conv;
22095         }
22096         FREE(o);
22097         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22098         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
22099         return tag_ptr(ret_conv, true);
22100 }
22101
22102 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
22103         void* e_ptr = untag_ptr(e);
22104         CHECK_ACCESS(e_ptr);
22105         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
22106         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
22107         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22108         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
22109         return tag_ptr(ret_conv, true);
22110 }
22111
22112 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
22113         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
22114         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
22115         return ret_conv;
22116 }
22117
22118 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
22119         if (!ptr_is_owned(_res)) return;
22120         void* _res_ptr = untag_ptr(_res);
22121         CHECK_ACCESS(_res_ptr);
22122         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
22123         FREE(untag_ptr(_res));
22124         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
22125 }
22126
22127 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
22128         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22129         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
22130         return tag_ptr(ret_conv, true);
22131 }
22132 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
22133         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
22134         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
22135         return ret_conv;
22136 }
22137
22138 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
22139         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
22140         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22141         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
22142         return tag_ptr(ret_conv, true);
22143 }
22144
22145 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
22146         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22147         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
22148         return tag_ptr(ret_conv, true);
22149 }
22150 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(uint64_t arg) {
22151         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
22152         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
22153         return ret_conv;
22154 }
22155
22156 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(uint64_t orig) {
22157         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
22158         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22159         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
22160         return tag_ptr(ret_conv, true);
22161 }
22162
22163 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
22164         LDKThirtyTwoBytes a_ref;
22165         CHECK(a->arr_len == 32);
22166         memcpy(a_ref.data, a->elems, 32); FREE(a);
22167         LDKPublicKey b_ref;
22168         CHECK(b->arr_len == 33);
22169         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
22170         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22171         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
22172         return tag_ptr(ret_conv, true);
22173 }
22174
22175 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(uint64_t _res) {
22176         if (!ptr_is_owned(_res)) return;
22177         void* _res_ptr = untag_ptr(_res);
22178         CHECK_ACCESS(_res_ptr);
22179         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
22180         FREE(untag_ptr(_res));
22181         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
22182 }
22183
22184 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(uint64_tArray _res) {
22185         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
22186         _res_constr.datalen = _res->arr_len;
22187         if (_res_constr.datalen > 0)
22188                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
22189         else
22190                 _res_constr.data = NULL;
22191         uint64_t* _res_vals = _res->elems;
22192         for (size_t j = 0; j < _res_constr.datalen; j++) {
22193                 uint64_t _res_conv_35 = _res_vals[j];
22194                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
22195                 CHECK_ACCESS(_res_conv_35_ptr);
22196                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
22197                 FREE(untag_ptr(_res_conv_35));
22198                 _res_constr.data[j] = _res_conv_35_conv;
22199         }
22200         FREE(_res);
22201         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
22202 }
22203
22204 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
22205         LDKStr o_conv = str_ref_to_owned_c(o);
22206         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22207         *ret_copy = COption_StrZ_some(o_conv);
22208         uint64_t ret_ref = tag_ptr(ret_copy, true);
22209         return ret_ref;
22210 }
22211
22212 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
22213         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22214         *ret_copy = COption_StrZ_none();
22215         uint64_t ret_ref = tag_ptr(ret_copy, true);
22216         return ret_ref;
22217 }
22218
22219 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
22220         if (!ptr_is_owned(_res)) return;
22221         void* _res_ptr = untag_ptr(_res);
22222         CHECK_ACCESS(_res_ptr);
22223         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
22224         FREE(untag_ptr(_res));
22225         COption_StrZ_free(_res_conv);
22226 }
22227
22228 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
22229         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22230         *ret_copy = COption_StrZ_clone(arg);
22231         uint64_t ret_ref = tag_ptr(ret_copy, true);
22232         return ret_ref;
22233 }
22234 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
22235         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
22236         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
22237         return ret_conv;
22238 }
22239
22240 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
22241         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
22242         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22243         *ret_copy = COption_StrZ_clone(orig_conv);
22244         uint64_t ret_ref = tag_ptr(ret_copy, true);
22245         return ret_ref;
22246 }
22247
22248 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
22249         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22250         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22251         return tag_ptr(ret_conv, true);
22252 }
22253
22254 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
22255         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22256         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22257         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22258         return tag_ptr(ret_conv, true);
22259 }
22260
22261 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
22262         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22263         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22264         return ret_conv;
22265 }
22266
22267 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
22268         if (!ptr_is_owned(_res)) return;
22269         void* _res_ptr = untag_ptr(_res);
22270         CHECK_ACCESS(_res_ptr);
22271         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22272         FREE(untag_ptr(_res));
22273         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22274 }
22275
22276 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22277         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22278         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22279         return tag_ptr(ret_conv, true);
22280 }
22281 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22282         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22283         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22284         return ret_conv;
22285 }
22286
22287 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
22288         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22289         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22290         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22291         return tag_ptr(ret_conv, true);
22292 }
22293
22294 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
22295         void* o_ptr = untag_ptr(o);
22296         CHECK_ACCESS(o_ptr);
22297         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22298         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22299         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22300         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
22301         return tag_ptr(ret_conv, true);
22302 }
22303
22304 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
22305         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22306         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
22307         return tag_ptr(ret_conv, true);
22308 }
22309
22310 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
22311         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
22312         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
22313         return ret_conv;
22314 }
22315
22316 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
22317         if (!ptr_is_owned(_res)) return;
22318         void* _res_ptr = untag_ptr(_res);
22319         CHECK_ACCESS(_res_ptr);
22320         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
22321         FREE(untag_ptr(_res));
22322         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
22323 }
22324
22325 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
22326         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22327         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
22328         return tag_ptr(ret_conv, true);
22329 }
22330 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
22331         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
22332         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
22333         return ret_conv;
22334 }
22335
22336 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
22337         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
22338         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22339         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
22344         void* o_ptr = untag_ptr(o);
22345         CHECK_ACCESS(o_ptr);
22346         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
22347         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
22348         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22349         *ret_copy = COption_OffersMessageZ_some(o_conv);
22350         uint64_t ret_ref = tag_ptr(ret_copy, true);
22351         return ret_ref;
22352 }
22353
22354 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
22355         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22356         *ret_copy = COption_OffersMessageZ_none();
22357         uint64_t ret_ref = tag_ptr(ret_copy, true);
22358         return ret_ref;
22359 }
22360
22361 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
22362         if (!ptr_is_owned(_res)) return;
22363         void* _res_ptr = untag_ptr(_res);
22364         CHECK_ACCESS(_res_ptr);
22365         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
22366         FREE(untag_ptr(_res));
22367         COption_OffersMessageZ_free(_res_conv);
22368 }
22369
22370 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
22371         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22372         *ret_copy = COption_OffersMessageZ_clone(arg);
22373         uint64_t ret_ref = tag_ptr(ret_copy, true);
22374         return ret_ref;
22375 }
22376 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
22377         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
22378         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
22379         return ret_conv;
22380 }
22381
22382 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
22383         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
22384         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22385         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
22386         uint64_t ret_ref = tag_ptr(ret_copy, true);
22387         return ret_ref;
22388 }
22389
22390 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
22391         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22392         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
22393         return tag_ptr(ret_conv, true);
22394 }
22395 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
22396         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
22397         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
22398         return ret_conv;
22399 }
22400
22401 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
22402         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
22403         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22404         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
22405         return tag_ptr(ret_conv, true);
22406 }
22407
22408 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
22409         void* a_ptr = untag_ptr(a);
22410         CHECK_ACCESS(a_ptr);
22411         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
22412         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
22413         void* b_ptr = untag_ptr(b);
22414         CHECK_ACCESS(b_ptr);
22415         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
22416         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
22417         LDKBlindedPath c_conv;
22418         c_conv.inner = untag_ptr(c);
22419         c_conv.is_owned = ptr_is_owned(c);
22420         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22421         c_conv = BlindedPath_clone(&c_conv);
22422         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22423         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
22424         return tag_ptr(ret_conv, true);
22425 }
22426
22427 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
22428         if (!ptr_is_owned(_res)) return;
22429         void* _res_ptr = untag_ptr(_res);
22430         CHECK_ACCESS(_res_ptr);
22431         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
22432         FREE(untag_ptr(_res));
22433         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
22434 }
22435
22436 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
22437         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
22438         _res_constr.datalen = _res->arr_len;
22439         if (_res_constr.datalen > 0)
22440                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
22441         else
22442                 _res_constr.data = NULL;
22443         uint64_t* _res_vals = _res->elems;
22444         for (size_t x = 0; x < _res_constr.datalen; x++) {
22445                 uint64_t _res_conv_49 = _res_vals[x];
22446                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22447                 CHECK_ACCESS(_res_conv_49_ptr);
22448                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
22449                 FREE(untag_ptr(_res_conv_49));
22450                 _res_constr.data[x] = _res_conv_49_conv;
22451         }
22452         FREE(_res);
22453         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
22454 }
22455
22456 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
22457         LDKCounterpartyForwardingInfo o_conv;
22458         o_conv.inner = untag_ptr(o);
22459         o_conv.is_owned = ptr_is_owned(o);
22460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22461         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
22462         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22463         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
22464         return tag_ptr(ret_conv, true);
22465 }
22466
22467 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
22468         void* e_ptr = untag_ptr(e);
22469         CHECK_ACCESS(e_ptr);
22470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22472         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22473         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
22474         return tag_ptr(ret_conv, true);
22475 }
22476
22477 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
22478         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
22479         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
22480         return ret_conv;
22481 }
22482
22483 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
22484         if (!ptr_is_owned(_res)) return;
22485         void* _res_ptr = untag_ptr(_res);
22486         CHECK_ACCESS(_res_ptr);
22487         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
22488         FREE(untag_ptr(_res));
22489         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
22490 }
22491
22492 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
22493         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22494         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
22495         return tag_ptr(ret_conv, true);
22496 }
22497 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
22498         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
22499         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
22500         return ret_conv;
22501 }
22502
22503 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
22504         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
22505         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22506         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
22507         return tag_ptr(ret_conv, true);
22508 }
22509
22510 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
22511         LDKChannelCounterparty o_conv;
22512         o_conv.inner = untag_ptr(o);
22513         o_conv.is_owned = ptr_is_owned(o);
22514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22515         o_conv = ChannelCounterparty_clone(&o_conv);
22516         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22517         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
22518         return tag_ptr(ret_conv, true);
22519 }
22520
22521 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
22522         void* e_ptr = untag_ptr(e);
22523         CHECK_ACCESS(e_ptr);
22524         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22525         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22526         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22527         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
22528         return tag_ptr(ret_conv, true);
22529 }
22530
22531 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
22532         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
22533         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
22534         return ret_conv;
22535 }
22536
22537 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
22538         if (!ptr_is_owned(_res)) return;
22539         void* _res_ptr = untag_ptr(_res);
22540         CHECK_ACCESS(_res_ptr);
22541         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
22542         FREE(untag_ptr(_res));
22543         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
22544 }
22545
22546 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
22547         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22548         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
22549         return tag_ptr(ret_conv, true);
22550 }
22551 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
22552         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
22553         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
22554         return ret_conv;
22555 }
22556
22557 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
22558         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
22559         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22560         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
22561         return tag_ptr(ret_conv, true);
22562 }
22563
22564 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
22565         LDKChannelDetails o_conv;
22566         o_conv.inner = untag_ptr(o);
22567         o_conv.is_owned = ptr_is_owned(o);
22568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22569         o_conv = ChannelDetails_clone(&o_conv);
22570         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22571         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
22572         return tag_ptr(ret_conv, true);
22573 }
22574
22575 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
22576         void* e_ptr = untag_ptr(e);
22577         CHECK_ACCESS(e_ptr);
22578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22580         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22581         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
22582         return tag_ptr(ret_conv, true);
22583 }
22584
22585 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
22586         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
22587         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
22588         return ret_conv;
22589 }
22590
22591 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
22592         if (!ptr_is_owned(_res)) return;
22593         void* _res_ptr = untag_ptr(_res);
22594         CHECK_ACCESS(_res_ptr);
22595         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
22596         FREE(untag_ptr(_res));
22597         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
22598 }
22599
22600 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
22601         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22602         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
22603         return tag_ptr(ret_conv, true);
22604 }
22605 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
22606         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
22607         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
22608         return ret_conv;
22609 }
22610
22611 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
22612         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
22613         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22614         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
22615         return tag_ptr(ret_conv, true);
22616 }
22617
22618 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
22619         LDKPhantomRouteHints o_conv;
22620         o_conv.inner = untag_ptr(o);
22621         o_conv.is_owned = ptr_is_owned(o);
22622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22623         o_conv = PhantomRouteHints_clone(&o_conv);
22624         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22625         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
22626         return tag_ptr(ret_conv, true);
22627 }
22628
22629 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
22630         void* e_ptr = untag_ptr(e);
22631         CHECK_ACCESS(e_ptr);
22632         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22633         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22634         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22635         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
22636         return tag_ptr(ret_conv, true);
22637 }
22638
22639 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
22640         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
22641         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
22642         return ret_conv;
22643 }
22644
22645 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
22646         if (!ptr_is_owned(_res)) return;
22647         void* _res_ptr = untag_ptr(_res);
22648         CHECK_ACCESS(_res_ptr);
22649         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
22650         FREE(untag_ptr(_res));
22651         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
22652 }
22653
22654 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
22655         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22656         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
22657         return tag_ptr(ret_conv, true);
22658 }
22659 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
22660         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
22661         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
22662         return ret_conv;
22663 }
22664
22665 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
22666         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
22667         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22668         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
22669         return tag_ptr(ret_conv, true);
22670 }
22671
22672 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_ok(uint64_t o) {
22673         LDKBlindedForward o_conv;
22674         o_conv.inner = untag_ptr(o);
22675         o_conv.is_owned = ptr_is_owned(o);
22676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22677         o_conv = BlindedForward_clone(&o_conv);
22678         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22679         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
22680         return tag_ptr(ret_conv, true);
22681 }
22682
22683 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_err"))) TS_CResult_BlindedForwardDecodeErrorZ_err(uint64_t e) {
22684         void* e_ptr = untag_ptr(e);
22685         CHECK_ACCESS(e_ptr);
22686         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22687         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22688         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22689         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
22690         return tag_ptr(ret_conv, true);
22691 }
22692
22693 jboolean  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_is_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_is_ok(uint64_t o) {
22694         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
22695         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
22696         return ret_conv;
22697 }
22698
22699 void  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_free"))) TS_CResult_BlindedForwardDecodeErrorZ_free(uint64_t _res) {
22700         if (!ptr_is_owned(_res)) return;
22701         void* _res_ptr = untag_ptr(_res);
22702         CHECK_ACCESS(_res_ptr);
22703         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
22704         FREE(untag_ptr(_res));
22705         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
22706 }
22707
22708 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
22709         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22710         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
22711         return tag_ptr(ret_conv, true);
22712 }
22713 int64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr(uint64_t arg) {
22714         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
22715         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
22716         return ret_conv;
22717 }
22718
22719 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone"))) TS_CResult_BlindedForwardDecodeErrorZ_clone(uint64_t orig) {
22720         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
22721         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22722         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
22723         return tag_ptr(ret_conv, true);
22724 }
22725
22726 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok(uint64_t o) {
22727         void* o_ptr = untag_ptr(o);
22728         CHECK_ACCESS(o_ptr);
22729         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
22730         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
22731         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22732         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
22733         return tag_ptr(ret_conv, true);
22734 }
22735
22736 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_err(uint64_t e) {
22737         void* e_ptr = untag_ptr(e);
22738         CHECK_ACCESS(e_ptr);
22739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22741         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22742         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
22743         return tag_ptr(ret_conv, true);
22744 }
22745
22746 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(uint64_t o) {
22747         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
22748         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
22749         return ret_conv;
22750 }
22751
22752 void  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_free"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_free(uint64_t _res) {
22753         if (!ptr_is_owned(_res)) return;
22754         void* _res_ptr = untag_ptr(_res);
22755         CHECK_ACCESS(_res_ptr);
22756         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
22757         FREE(untag_ptr(_res));
22758         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
22759 }
22760
22761 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
22762         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22763         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
22764         return tag_ptr(ret_conv, true);
22765 }
22766 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(uint64_t arg) {
22767         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
22768         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
22769         return ret_conv;
22770 }
22771
22772 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone(uint64_t orig) {
22773         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
22774         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22775         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
22776         return tag_ptr(ret_conv, true);
22777 }
22778
22779 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_ok(uint64_t o) {
22780         LDKPendingHTLCInfo o_conv;
22781         o_conv.inner = untag_ptr(o);
22782         o_conv.is_owned = ptr_is_owned(o);
22783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22784         o_conv = PendingHTLCInfo_clone(&o_conv);
22785         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22786         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
22787         return tag_ptr(ret_conv, true);
22788 }
22789
22790 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_err(uint64_t e) {
22791         void* e_ptr = untag_ptr(e);
22792         CHECK_ACCESS(e_ptr);
22793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22795         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22796         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
22797         return tag_ptr(ret_conv, true);
22798 }
22799
22800 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(uint64_t o) {
22801         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
22802         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
22803         return ret_conv;
22804 }
22805
22806 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_free"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_free(uint64_t _res) {
22807         if (!ptr_is_owned(_res)) return;
22808         void* _res_ptr = untag_ptr(_res);
22809         CHECK_ACCESS(_res_ptr);
22810         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
22811         FREE(untag_ptr(_res));
22812         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
22813 }
22814
22815 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
22816         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22817         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
22818         return tag_ptr(ret_conv, true);
22819 }
22820 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
22821         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
22822         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
22823         return ret_conv;
22824 }
22825
22826 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone(uint64_t orig) {
22827         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
22828         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22829         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
22830         return tag_ptr(ret_conv, true);
22831 }
22832
22833 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_ok(uint32_t o) {
22834         LDKBlindedFailure o_conv = LDKBlindedFailure_from_js(o);
22835         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22836         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
22837         return tag_ptr(ret_conv, true);
22838 }
22839
22840 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_err"))) TS_CResult_BlindedFailureDecodeErrorZ_err(uint64_t e) {
22841         void* e_ptr = untag_ptr(e);
22842         CHECK_ACCESS(e_ptr);
22843         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22844         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22845         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22846         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
22847         return tag_ptr(ret_conv, true);
22848 }
22849
22850 jboolean  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_is_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_is_ok(uint64_t o) {
22851         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
22852         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
22853         return ret_conv;
22854 }
22855
22856 void  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_free"))) TS_CResult_BlindedFailureDecodeErrorZ_free(uint64_t _res) {
22857         if (!ptr_is_owned(_res)) return;
22858         void* _res_ptr = untag_ptr(_res);
22859         CHECK_ACCESS(_res_ptr);
22860         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
22861         FREE(untag_ptr(_res));
22862         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
22863 }
22864
22865 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
22866         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22867         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
22868         return tag_ptr(ret_conv, true);
22869 }
22870 int64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr(uint64_t arg) {
22871         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
22872         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
22873         return ret_conv;
22874 }
22875
22876 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone"))) TS_CResult_BlindedFailureDecodeErrorZ_clone(uint64_t orig) {
22877         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
22878         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22879         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
22880         return tag_ptr(ret_conv, true);
22881 }
22882
22883 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
22884         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
22885         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22886         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
22887         return tag_ptr(ret_conv, true);
22888 }
22889
22890 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
22891         void* e_ptr = untag_ptr(e);
22892         CHECK_ACCESS(e_ptr);
22893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22895         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22896         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
22897         return tag_ptr(ret_conv, true);
22898 }
22899
22900 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
22901         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
22902         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
22903         return ret_conv;
22904 }
22905
22906 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
22907         if (!ptr_is_owned(_res)) return;
22908         void* _res_ptr = untag_ptr(_res);
22909         CHECK_ACCESS(_res_ptr);
22910         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
22911         FREE(untag_ptr(_res));
22912         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
22913 }
22914
22915 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
22916         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22917         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
22918         return tag_ptr(ret_conv, true);
22919 }
22920 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
22921         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
22922         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
22923         return ret_conv;
22924 }
22925
22926 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
22927         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
22928         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22929         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
22930         return tag_ptr(ret_conv, true);
22931 }
22932
22933 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
22934         LDKCVec_ChannelMonitorZ _res_constr;
22935         _res_constr.datalen = _res->arr_len;
22936         if (_res_constr.datalen > 0)
22937                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
22938         else
22939                 _res_constr.data = NULL;
22940         uint64_t* _res_vals = _res->elems;
22941         for (size_t q = 0; q < _res_constr.datalen; q++) {
22942                 uint64_t _res_conv_16 = _res_vals[q];
22943                 LDKChannelMonitor _res_conv_16_conv;
22944                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22945                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22947                 _res_constr.data[q] = _res_conv_16_conv;
22948         }
22949         FREE(_res);
22950         CVec_ChannelMonitorZ_free(_res_constr);
22951 }
22952
22953 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
22954         LDKThirtyTwoBytes a_ref;
22955         CHECK(a->arr_len == 32);
22956         memcpy(a_ref.data, a->elems, 32); FREE(a);
22957         LDKChannelManager b_conv;
22958         b_conv.inner = untag_ptr(b);
22959         b_conv.is_owned = ptr_is_owned(b);
22960         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22961         // WARNING: we need a move here but no clone is available for LDKChannelManager
22962         
22963         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
22964         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
22965         return tag_ptr(ret_conv, true);
22966 }
22967
22968 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
22969         if (!ptr_is_owned(_res)) return;
22970         void* _res_ptr = untag_ptr(_res);
22971         CHECK_ACCESS(_res_ptr);
22972         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
22973         FREE(untag_ptr(_res));
22974         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
22975 }
22976
22977 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
22978         void* o_ptr = untag_ptr(o);
22979         CHECK_ACCESS(o_ptr);
22980         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
22981         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
22982         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
22983         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
22984         return tag_ptr(ret_conv, true);
22985 }
22986
22987 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
22988         void* e_ptr = untag_ptr(e);
22989         CHECK_ACCESS(e_ptr);
22990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22992         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
22993         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
22994         return tag_ptr(ret_conv, true);
22995 }
22996
22997 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
22998         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
22999         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
23000         return ret_conv;
23001 }
23002
23003 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
23004         if (!ptr_is_owned(_res)) return;
23005         void* _res_ptr = untag_ptr(_res);
23006         CHECK_ACCESS(_res_ptr);
23007         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
23008         FREE(untag_ptr(_res));
23009         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
23010 }
23011
23012 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
23013         void* o_ptr = untag_ptr(o);
23014         CHECK_ACCESS(o_ptr);
23015         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23016         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23017         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23018         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
23019         return tag_ptr(ret_conv, true);
23020 }
23021
23022 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
23023         void* e_ptr = untag_ptr(e);
23024         CHECK_ACCESS(e_ptr);
23025         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23026         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23027         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23028         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
23029         return tag_ptr(ret_conv, true);
23030 }
23031
23032 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
23033         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
23034         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
23035         return ret_conv;
23036 }
23037
23038 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
23039         if (!ptr_is_owned(_res)) return;
23040         void* _res_ptr = untag_ptr(_res);
23041         CHECK_ACCESS(_res_ptr);
23042         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
23043         FREE(untag_ptr(_res));
23044         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
23045 }
23046
23047 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
23048         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23049         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
23050         return tag_ptr(ret_conv, true);
23051 }
23052 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
23053         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
23054         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
23055         return ret_conv;
23056 }
23057
23058 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
23059         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
23060         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23061         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
23062         return tag_ptr(ret_conv, true);
23063 }
23064
23065 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
23066         LDKChannelConfig o_conv;
23067         o_conv.inner = untag_ptr(o);
23068         o_conv.is_owned = ptr_is_owned(o);
23069         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23070         o_conv = ChannelConfig_clone(&o_conv);
23071         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23072         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
23073         return tag_ptr(ret_conv, true);
23074 }
23075
23076 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
23077         void* e_ptr = untag_ptr(e);
23078         CHECK_ACCESS(e_ptr);
23079         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23080         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23081         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23082         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
23083         return tag_ptr(ret_conv, true);
23084 }
23085
23086 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
23087         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
23088         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
23089         return ret_conv;
23090 }
23091
23092 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
23093         if (!ptr_is_owned(_res)) return;
23094         void* _res_ptr = untag_ptr(_res);
23095         CHECK_ACCESS(_res_ptr);
23096         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
23097         FREE(untag_ptr(_res));
23098         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
23099 }
23100
23101 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
23102         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23103         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
23104         return tag_ptr(ret_conv, true);
23105 }
23106 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
23107         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
23108         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
23109         return ret_conv;
23110 }
23111
23112 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
23113         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
23114         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23115         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
23116         return tag_ptr(ret_conv, true);
23117 }
23118
23119 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
23120         void* o_ptr = untag_ptr(o);
23121         CHECK_ACCESS(o_ptr);
23122         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23123         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23124         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23125         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
23126         uint64_t ret_ref = tag_ptr(ret_copy, true);
23127         return ret_ref;
23128 }
23129
23130 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
23131         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23132         *ret_copy = COption_MaxDustHTLCExposureZ_none();
23133         uint64_t ret_ref = tag_ptr(ret_copy, true);
23134         return ret_ref;
23135 }
23136
23137 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
23138         if (!ptr_is_owned(_res)) return;
23139         void* _res_ptr = untag_ptr(_res);
23140         CHECK_ACCESS(_res_ptr);
23141         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
23142         FREE(untag_ptr(_res));
23143         COption_MaxDustHTLCExposureZ_free(_res_conv);
23144 }
23145
23146 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
23147         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23148         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
23149         uint64_t ret_ref = tag_ptr(ret_copy, true);
23150         return ret_ref;
23151 }
23152 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
23153         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
23154         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
23155         return ret_conv;
23156 }
23157
23158 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
23159         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
23160         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23161         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
23162         uint64_t ret_ref = tag_ptr(ret_copy, true);
23163         return ret_ref;
23164 }
23165
23166 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
23167         void* o_ptr = untag_ptr(o);
23168         CHECK_ACCESS(o_ptr);
23169         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
23170         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
23171         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23172         *ret_copy = COption_APIErrorZ_some(o_conv);
23173         uint64_t ret_ref = tag_ptr(ret_copy, true);
23174         return ret_ref;
23175 }
23176
23177 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
23178         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23179         *ret_copy = COption_APIErrorZ_none();
23180         uint64_t ret_ref = tag_ptr(ret_copy, true);
23181         return ret_ref;
23182 }
23183
23184 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
23185         if (!ptr_is_owned(_res)) return;
23186         void* _res_ptr = untag_ptr(_res);
23187         CHECK_ACCESS(_res_ptr);
23188         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
23189         FREE(untag_ptr(_res));
23190         COption_APIErrorZ_free(_res_conv);
23191 }
23192
23193 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
23194         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23195         *ret_copy = COption_APIErrorZ_clone(arg);
23196         uint64_t ret_ref = tag_ptr(ret_copy, true);
23197         return ret_ref;
23198 }
23199 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
23200         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
23201         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
23202         return ret_conv;
23203 }
23204
23205 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
23206         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
23207         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23208         *ret_copy = COption_APIErrorZ_clone(orig_conv);
23209         uint64_t ret_ref = tag_ptr(ret_copy, true);
23210         return ret_ref;
23211 }
23212
23213 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
23214         void* o_ptr = untag_ptr(o);
23215         CHECK_ACCESS(o_ptr);
23216         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
23217         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
23218         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23219         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
23220         return tag_ptr(ret_conv, true);
23221 }
23222
23223 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
23224         void* e_ptr = untag_ptr(e);
23225         CHECK_ACCESS(e_ptr);
23226         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23227         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23228         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23229         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
23230         return tag_ptr(ret_conv, true);
23231 }
23232
23233 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
23234         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
23235         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
23236         return ret_conv;
23237 }
23238
23239 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
23240         if (!ptr_is_owned(_res)) return;
23241         void* _res_ptr = untag_ptr(_res);
23242         CHECK_ACCESS(_res_ptr);
23243         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
23244         FREE(untag_ptr(_res));
23245         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
23246 }
23247
23248 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
23249         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23250         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
23251         return tag_ptr(ret_conv, true);
23252 }
23253 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
23254         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
23255         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
23256         return ret_conv;
23257 }
23258
23259 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
23260         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
23261         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23262         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
23263         return tag_ptr(ret_conv, true);
23264 }
23265
23266 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
23267         LDKChannelMonitorUpdate o_conv;
23268         o_conv.inner = untag_ptr(o);
23269         o_conv.is_owned = ptr_is_owned(o);
23270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23271         o_conv = ChannelMonitorUpdate_clone(&o_conv);
23272         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23273         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
23274         return tag_ptr(ret_conv, true);
23275 }
23276
23277 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
23278         void* e_ptr = untag_ptr(e);
23279         CHECK_ACCESS(e_ptr);
23280         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23281         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23282         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23283         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
23284         return tag_ptr(ret_conv, true);
23285 }
23286
23287 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
23288         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
23289         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
23290         return ret_conv;
23291 }
23292
23293 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
23294         if (!ptr_is_owned(_res)) return;
23295         void* _res_ptr = untag_ptr(_res);
23296         CHECK_ACCESS(_res_ptr);
23297         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
23298         FREE(untag_ptr(_res));
23299         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
23300 }
23301
23302 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
23303         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23304         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
23305         return tag_ptr(ret_conv, true);
23306 }
23307 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
23308         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
23309         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
23310         return ret_conv;
23311 }
23312
23313 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
23314         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
23315         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23316         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
23317         return tag_ptr(ret_conv, true);
23318 }
23319
23320 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
23321         void* o_ptr = untag_ptr(o);
23322         CHECK_ACCESS(o_ptr);
23323         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
23324         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
23325         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23326         *ret_copy = COption_MonitorEventZ_some(o_conv);
23327         uint64_t ret_ref = tag_ptr(ret_copy, true);
23328         return ret_ref;
23329 }
23330
23331 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
23332         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23333         *ret_copy = COption_MonitorEventZ_none();
23334         uint64_t ret_ref = tag_ptr(ret_copy, true);
23335         return ret_ref;
23336 }
23337
23338 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
23339         if (!ptr_is_owned(_res)) return;
23340         void* _res_ptr = untag_ptr(_res);
23341         CHECK_ACCESS(_res_ptr);
23342         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
23343         FREE(untag_ptr(_res));
23344         COption_MonitorEventZ_free(_res_conv);
23345 }
23346
23347 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
23348         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23349         *ret_copy = COption_MonitorEventZ_clone(arg);
23350         uint64_t ret_ref = tag_ptr(ret_copy, true);
23351         return ret_ref;
23352 }
23353 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
23354         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
23355         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
23356         return ret_conv;
23357 }
23358
23359 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
23360         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
23361         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23362         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
23363         uint64_t ret_ref = tag_ptr(ret_copy, true);
23364         return ret_ref;
23365 }
23366
23367 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
23368         void* o_ptr = untag_ptr(o);
23369         CHECK_ACCESS(o_ptr);
23370         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
23371         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
23372         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23373         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
23374         return tag_ptr(ret_conv, true);
23375 }
23376
23377 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
23378         void* e_ptr = untag_ptr(e);
23379         CHECK_ACCESS(e_ptr);
23380         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23381         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23382         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23383         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
23384         return tag_ptr(ret_conv, true);
23385 }
23386
23387 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
23388         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
23389         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
23390         return ret_conv;
23391 }
23392
23393 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
23394         if (!ptr_is_owned(_res)) return;
23395         void* _res_ptr = untag_ptr(_res);
23396         CHECK_ACCESS(_res_ptr);
23397         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
23398         FREE(untag_ptr(_res));
23399         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
23400 }
23401
23402 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
23403         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23404         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
23405         return tag_ptr(ret_conv, true);
23406 }
23407 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
23408         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
23409         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
23410         return ret_conv;
23411 }
23412
23413 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
23414         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
23415         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23416         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
23417         return tag_ptr(ret_conv, true);
23418 }
23419
23420 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
23421         LDKHTLCUpdate o_conv;
23422         o_conv.inner = untag_ptr(o);
23423         o_conv.is_owned = ptr_is_owned(o);
23424         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23425         o_conv = HTLCUpdate_clone(&o_conv);
23426         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23427         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
23428         return tag_ptr(ret_conv, true);
23429 }
23430
23431 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
23432         void* e_ptr = untag_ptr(e);
23433         CHECK_ACCESS(e_ptr);
23434         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23435         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23436         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23437         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
23438         return tag_ptr(ret_conv, true);
23439 }
23440
23441 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
23442         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
23443         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
23444         return ret_conv;
23445 }
23446
23447 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
23448         if (!ptr_is_owned(_res)) return;
23449         void* _res_ptr = untag_ptr(_res);
23450         CHECK_ACCESS(_res_ptr);
23451         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
23452         FREE(untag_ptr(_res));
23453         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
23454 }
23455
23456 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
23457         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23458         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
23459         return tag_ptr(ret_conv, true);
23460 }
23461 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
23462         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
23463         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
23464         return ret_conv;
23465 }
23466
23467 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
23468         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
23469         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23470         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
23471         return tag_ptr(ret_conv, true);
23472 }
23473
23474 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
23475         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23476         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
23477         return tag_ptr(ret_conv, true);
23478 }
23479 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
23480         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
23481         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
23482         return ret_conv;
23483 }
23484
23485 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
23486         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
23487         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23488         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
23489         return tag_ptr(ret_conv, true);
23490 }
23491
23492 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
23493         LDKOutPoint a_conv;
23494         a_conv.inner = untag_ptr(a);
23495         a_conv.is_owned = ptr_is_owned(a);
23496         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23497         a_conv = OutPoint_clone(&a_conv);
23498         LDKCVec_u8Z b_ref;
23499         b_ref.datalen = b->arr_len;
23500         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23501         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23502         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23503         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
23504         return tag_ptr(ret_conv, true);
23505 }
23506
23507 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
23508         if (!ptr_is_owned(_res)) return;
23509         void* _res_ptr = untag_ptr(_res);
23510         CHECK_ACCESS(_res_ptr);
23511         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
23512         FREE(untag_ptr(_res));
23513         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
23514 }
23515
23516 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
23517         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23518         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
23519         return tag_ptr(ret_conv, true);
23520 }
23521 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
23522         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
23523         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
23524         return ret_conv;
23525 }
23526
23527 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
23528         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
23529         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23530         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
23531         return tag_ptr(ret_conv, true);
23532 }
23533
23534 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
23535         LDKCVec_u8Z b_ref;
23536         b_ref.datalen = b->arr_len;
23537         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23538         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23539         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23540         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
23541         return tag_ptr(ret_conv, true);
23542 }
23543
23544 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
23545         if (!ptr_is_owned(_res)) return;
23546         void* _res_ptr = untag_ptr(_res);
23547         CHECK_ACCESS(_res_ptr);
23548         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
23549         FREE(untag_ptr(_res));
23550         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
23551 }
23552
23553 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
23554         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
23555         _res_constr.datalen = _res->arr_len;
23556         if (_res_constr.datalen > 0)
23557                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23558         else
23559                 _res_constr.data = NULL;
23560         uint64_t* _res_vals = _res->elems;
23561         for (size_t x = 0; x < _res_constr.datalen; x++) {
23562                 uint64_t _res_conv_23 = _res_vals[x];
23563                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
23564                 CHECK_ACCESS(_res_conv_23_ptr);
23565                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
23566                 FREE(untag_ptr(_res_conv_23));
23567                 _res_constr.data[x] = _res_conv_23_conv;
23568         }
23569         FREE(_res);
23570         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
23571 }
23572
23573 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
23574         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23575         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
23576         return tag_ptr(ret_conv, true);
23577 }
23578 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
23579         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
23580         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
23581         return ret_conv;
23582 }
23583
23584 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
23585         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
23586         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23587         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
23588         return tag_ptr(ret_conv, true);
23589 }
23590
23591 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) {
23592         LDKThirtyTwoBytes a_ref;
23593         CHECK(a->arr_len == 32);
23594         memcpy(a_ref.data, a->elems, 32); FREE(a);
23595         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
23596         b_constr.datalen = b->arr_len;
23597         if (b_constr.datalen > 0)
23598                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23599         else
23600                 b_constr.data = NULL;
23601         uint64_t* b_vals = b->elems;
23602         for (size_t x = 0; x < b_constr.datalen; x++) {
23603                 uint64_t b_conv_23 = b_vals[x];
23604                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
23605                 CHECK_ACCESS(b_conv_23_ptr);
23606                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
23607                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
23608                 b_constr.data[x] = b_conv_23_conv;
23609         }
23610         FREE(b);
23611         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23612         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
23613         return tag_ptr(ret_conv, true);
23614 }
23615
23616 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
23617         if (!ptr_is_owned(_res)) return;
23618         void* _res_ptr = untag_ptr(_res);
23619         CHECK_ACCESS(_res_ptr);
23620         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
23621         FREE(untag_ptr(_res));
23622         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
23623 }
23624
23625 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
23626         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
23627         _res_constr.datalen = _res->arr_len;
23628         if (_res_constr.datalen > 0)
23629                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
23630         else
23631                 _res_constr.data = NULL;
23632         uint64_t* _res_vals = _res->elems;
23633         for (size_t a = 0; a < _res_constr.datalen; a++) {
23634                 uint64_t _res_conv_52 = _res_vals[a];
23635                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
23636                 CHECK_ACCESS(_res_conv_52_ptr);
23637                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
23638                 FREE(untag_ptr(_res_conv_52));
23639                 _res_constr.data[a] = _res_conv_52_conv;
23640         }
23641         FREE(_res);
23642         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
23643 }
23644
23645 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
23646         LDKCVec_CommitmentTransactionZ _res_constr;
23647         _res_constr.datalen = _res->arr_len;
23648         if (_res_constr.datalen > 0)
23649                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
23650         else
23651                 _res_constr.data = NULL;
23652         uint64_t* _res_vals = _res->elems;
23653         for (size_t x = 0; x < _res_constr.datalen; x++) {
23654                 uint64_t _res_conv_23 = _res_vals[x];
23655                 LDKCommitmentTransaction _res_conv_23_conv;
23656                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
23657                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
23658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
23659                 _res_constr.data[x] = _res_conv_23_conv;
23660         }
23661         FREE(_res);
23662         CVec_CommitmentTransactionZ_free(_res_constr);
23663 }
23664
23665 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
23666         LDKCVec_TransactionZ _res_constr;
23667         _res_constr.datalen = _res->arr_len;
23668         if (_res_constr.datalen > 0)
23669                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
23670         else
23671                 _res_constr.data = NULL;
23672         int8_tArray* _res_vals = (void*) _res->elems;
23673         for (size_t m = 0; m < _res_constr.datalen; m++) {
23674                 int8_tArray _res_conv_12 = _res_vals[m];
23675                 LDKTransaction _res_conv_12_ref;
23676                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
23677                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
23678                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
23679                 _res_conv_12_ref.data_is_owned = true;
23680                 _res_constr.data[m] = _res_conv_12_ref;
23681         }
23682         FREE(_res);
23683         CVec_TransactionZ_free(_res_constr);
23684 }
23685
23686 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
23687         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
23688         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
23689         return tag_ptr(ret_conv, true);
23690 }
23691 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
23692         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
23693         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
23694         return ret_conv;
23695 }
23696
23697 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
23698         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
23699         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
23700         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
23701         return tag_ptr(ret_conv, true);
23702 }
23703
23704 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
23705         void* b_ptr = untag_ptr(b);
23706         CHECK_ACCESS(b_ptr);
23707         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
23708         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
23709         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
23710         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
23711         return tag_ptr(ret_conv, true);
23712 }
23713
23714 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
23715         if (!ptr_is_owned(_res)) return;
23716         void* _res_ptr = untag_ptr(_res);
23717         CHECK_ACCESS(_res_ptr);
23718         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
23719         FREE(untag_ptr(_res));
23720         C2Tuple_u32TxOutZ_free(_res_conv);
23721 }
23722
23723 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
23724         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
23725         _res_constr.datalen = _res->arr_len;
23726         if (_res_constr.datalen > 0)
23727                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
23728         else
23729                 _res_constr.data = NULL;
23730         uint64_t* _res_vals = _res->elems;
23731         for (size_t u = 0; u < _res_constr.datalen; u++) {
23732                 uint64_t _res_conv_20 = _res_vals[u];
23733                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
23734                 CHECK_ACCESS(_res_conv_20_ptr);
23735                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
23736                 FREE(untag_ptr(_res_conv_20));
23737                 _res_constr.data[u] = _res_conv_20_conv;
23738         }
23739         FREE(_res);
23740         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
23741 }
23742
23743 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
23744         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
23745         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
23746         return tag_ptr(ret_conv, true);
23747 }
23748 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
23749         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
23750         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
23751         return ret_conv;
23752 }
23753
23754 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
23755         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
23756         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
23757         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
23758         return tag_ptr(ret_conv, true);
23759 }
23760
23761 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
23762         LDKThirtyTwoBytes a_ref;
23763         CHECK(a->arr_len == 32);
23764         memcpy(a_ref.data, a->elems, 32); FREE(a);
23765         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
23766         b_constr.datalen = b->arr_len;
23767         if (b_constr.datalen > 0)
23768                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
23769         else
23770                 b_constr.data = NULL;
23771         uint64_t* b_vals = b->elems;
23772         for (size_t u = 0; u < b_constr.datalen; u++) {
23773                 uint64_t b_conv_20 = b_vals[u];
23774                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
23775                 CHECK_ACCESS(b_conv_20_ptr);
23776                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
23777                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
23778                 b_constr.data[u] = b_conv_20_conv;
23779         }
23780         FREE(b);
23781         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
23782         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
23783         return tag_ptr(ret_conv, true);
23784 }
23785
23786 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
23787         if (!ptr_is_owned(_res)) return;
23788         void* _res_ptr = untag_ptr(_res);
23789         CHECK_ACCESS(_res_ptr);
23790         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
23791         FREE(untag_ptr(_res));
23792         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
23793 }
23794
23795 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
23796         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
23797         _res_constr.datalen = _res->arr_len;
23798         if (_res_constr.datalen > 0)
23799                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
23800         else
23801                 _res_constr.data = NULL;
23802         uint64_t* _res_vals = _res->elems;
23803         for (size_t x = 0; x < _res_constr.datalen; x++) {
23804                 uint64_t _res_conv_49 = _res_vals[x];
23805                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23806                 CHECK_ACCESS(_res_conv_49_ptr);
23807                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
23808                 FREE(untag_ptr(_res_conv_49));
23809                 _res_constr.data[x] = _res_conv_49_conv;
23810         }
23811         FREE(_res);
23812         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
23813 }
23814
23815 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
23816         LDKCVec_BalanceZ _res_constr;
23817         _res_constr.datalen = _res->arr_len;
23818         if (_res_constr.datalen > 0)
23819                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
23820         else
23821                 _res_constr.data = NULL;
23822         uint64_t* _res_vals = _res->elems;
23823         for (size_t j = 0; j < _res_constr.datalen; j++) {
23824                 uint64_t _res_conv_9 = _res_vals[j];
23825                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
23826                 CHECK_ACCESS(_res_conv_9_ptr);
23827                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
23828                 FREE(untag_ptr(_res_conv_9));
23829                 _res_constr.data[j] = _res_conv_9_conv;
23830         }
23831         FREE(_res);
23832         CVec_BalanceZ_free(_res_constr);
23833 }
23834
23835 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
23836         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
23837         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
23838         return tag_ptr(ret_conv, true);
23839 }
23840 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
23841         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
23842         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
23843         return ret_conv;
23844 }
23845
23846 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
23847         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
23848         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
23849         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
23850         return tag_ptr(ret_conv, true);
23851 }
23852
23853 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
23854         LDKThirtyTwoBytes a_ref;
23855         CHECK(a->arr_len == 32);
23856         memcpy(a_ref.data, a->elems, 32); FREE(a);
23857         LDKChannelMonitor b_conv;
23858         b_conv.inner = untag_ptr(b);
23859         b_conv.is_owned = ptr_is_owned(b);
23860         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23861         b_conv = ChannelMonitor_clone(&b_conv);
23862         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
23863         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
23864         return tag_ptr(ret_conv, true);
23865 }
23866
23867 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
23868         if (!ptr_is_owned(_res)) return;
23869         void* _res_ptr = untag_ptr(_res);
23870         CHECK_ACCESS(_res_ptr);
23871         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
23872         FREE(untag_ptr(_res));
23873         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
23874 }
23875
23876 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
23877         void* o_ptr = untag_ptr(o);
23878         CHECK_ACCESS(o_ptr);
23879         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
23880         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
23881         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23882         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
23883         return tag_ptr(ret_conv, true);
23884 }
23885
23886 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
23887         void* e_ptr = untag_ptr(e);
23888         CHECK_ACCESS(e_ptr);
23889         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23890         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23891         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23892         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
23893         return tag_ptr(ret_conv, true);
23894 }
23895
23896 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
23897         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
23898         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
23899         return ret_conv;
23900 }
23901
23902 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
23903         if (!ptr_is_owned(_res)) return;
23904         void* _res_ptr = untag_ptr(_res);
23905         CHECK_ACCESS(_res_ptr);
23906         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
23907         FREE(untag_ptr(_res));
23908         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
23909 }
23910
23911 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
23912         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23913         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
23914         return tag_ptr(ret_conv, true);
23915 }
23916 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
23917         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
23918         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
23919         return ret_conv;
23920 }
23921
23922 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
23923         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
23924         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23925         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
23926         return tag_ptr(ret_conv, true);
23927 }
23928
23929 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
23930         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
23931         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
23932         return tag_ptr(ret_conv, true);
23933 }
23934 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
23935         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
23936         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
23937         return ret_conv;
23938 }
23939
23940 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
23941         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
23942         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
23943         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
23944         return tag_ptr(ret_conv, true);
23945 }
23946
23947 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
23948         LDKPublicKey a_ref;
23949         CHECK(a->arr_len == 33);
23950         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
23951         void* b_ptr = untag_ptr(b);
23952         CHECK_ACCESS(b_ptr);
23953         LDKType b_conv = *(LDKType*)(b_ptr);
23954         if (b_conv.free == LDKType_JCalls_free) {
23955                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23956                 LDKType_JCalls_cloned(&b_conv);
23957         }
23958         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
23959         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
23960         return tag_ptr(ret_conv, true);
23961 }
23962
23963 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
23964         if (!ptr_is_owned(_res)) return;
23965         void* _res_ptr = untag_ptr(_res);
23966         CHECK_ACCESS(_res_ptr);
23967         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
23968         FREE(untag_ptr(_res));
23969         C2Tuple_PublicKeyTypeZ_free(_res_conv);
23970 }
23971
23972 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
23973         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
23974         _res_constr.datalen = _res->arr_len;
23975         if (_res_constr.datalen > 0)
23976                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
23977         else
23978                 _res_constr.data = NULL;
23979         uint64_t* _res_vals = _res->elems;
23980         for (size_t z = 0; z < _res_constr.datalen; z++) {
23981                 uint64_t _res_conv_25 = _res_vals[z];
23982                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
23983                 CHECK_ACCESS(_res_conv_25_ptr);
23984                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
23985                 FREE(untag_ptr(_res_conv_25));
23986                 _res_constr.data[z] = _res_conv_25_conv;
23987         }
23988         FREE(_res);
23989         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
23990 }
23991
23992 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
23993         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
23994         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
23995         return tag_ptr(ret_conv, true);
23996 }
23997 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
23998         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
23999         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
24000         return ret_conv;
24001 }
24002
24003 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(uint64_t orig) {
24004         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
24005         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24006         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
24007         return tag_ptr(ret_conv, true);
24008 }
24009
24010 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, uint64_tArray b) {
24011         LDKPublicKey a_ref;
24012         CHECK(a->arr_len == 33);
24013         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24014         LDKCVec_SocketAddressZ b_constr;
24015         b_constr.datalen = b->arr_len;
24016         if (b_constr.datalen > 0)
24017                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24018         else
24019                 b_constr.data = NULL;
24020         uint64_t* b_vals = b->elems;
24021         for (size_t p = 0; p < b_constr.datalen; p++) {
24022                 uint64_t b_conv_15 = b_vals[p];
24023                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
24024                 CHECK_ACCESS(b_conv_15_ptr);
24025                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
24026                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
24027                 b_constr.data[p] = b_conv_15_conv;
24028         }
24029         FREE(b);
24030         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24031         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
24032         return tag_ptr(ret_conv, true);
24033 }
24034
24035 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(uint64_t _res) {
24036         if (!ptr_is_owned(_res)) return;
24037         void* _res_ptr = untag_ptr(_res);
24038         CHECK_ACCESS(_res_ptr);
24039         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
24040         FREE(untag_ptr(_res));
24041         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
24042 }
24043
24044 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(uint64_tArray _res) {
24045         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
24046         _res_constr.datalen = _res->arr_len;
24047         if (_res_constr.datalen > 0)
24048                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
24049         else
24050                 _res_constr.data = NULL;
24051         uint64_t* _res_vals = _res->elems;
24052         for (size_t o = 0; o < _res_constr.datalen; o++) {
24053                 uint64_t _res_conv_40 = _res_vals[o];
24054                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24055                 CHECK_ACCESS(_res_conv_40_ptr);
24056                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
24057                 FREE(untag_ptr(_res_conv_40));
24058                 _res_constr.data[o] = _res_conv_40_conv;
24059         }
24060         FREE(_res);
24061         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
24062 }
24063
24064 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
24065         void* o_ptr = untag_ptr(o);
24066         CHECK_ACCESS(o_ptr);
24067         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
24068         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
24069                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24070                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
24071         }
24072         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24073         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
24074         uint64_t ret_ref = tag_ptr(ret_copy, true);
24075         return ret_ref;
24076 }
24077
24078 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
24079         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24080         *ret_copy = COption_OnionMessageContentsZ_none();
24081         uint64_t ret_ref = tag_ptr(ret_copy, true);
24082         return ret_ref;
24083 }
24084
24085 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
24086         if (!ptr_is_owned(_res)) return;
24087         void* _res_ptr = untag_ptr(_res);
24088         CHECK_ACCESS(_res_ptr);
24089         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
24090         FREE(untag_ptr(_res));
24091         COption_OnionMessageContentsZ_free(_res_conv);
24092 }
24093
24094 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
24095         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24096         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
24097         uint64_t ret_ref = tag_ptr(ret_copy, true);
24098         return ret_ref;
24099 }
24100 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
24101         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
24102         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
24103         return ret_conv;
24104 }
24105
24106 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
24107         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
24108         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24109         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
24110         uint64_t ret_ref = tag_ptr(ret_copy, true);
24111         return ret_ref;
24112 }
24113
24114 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
24115         void* o_ptr = untag_ptr(o);
24116         CHECK_ACCESS(o_ptr);
24117         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
24118         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
24119         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24120         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
24121         return tag_ptr(ret_conv, true);
24122 }
24123
24124 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
24125         void* e_ptr = untag_ptr(e);
24126         CHECK_ACCESS(e_ptr);
24127         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24128         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24129         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24130         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
24131         return tag_ptr(ret_conv, true);
24132 }
24133
24134 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
24135         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
24136         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
24137         return ret_conv;
24138 }
24139
24140 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
24141         if (!ptr_is_owned(_res)) return;
24142         void* _res_ptr = untag_ptr(_res);
24143         CHECK_ACCESS(_res_ptr);
24144         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
24145         FREE(untag_ptr(_res));
24146         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
24147 }
24148
24149 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
24150         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24151         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
24152         return tag_ptr(ret_conv, true);
24153 }
24154 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
24155         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
24156         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
24157         return ret_conv;
24158 }
24159
24160 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
24161         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
24162         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24163         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
24164         return tag_ptr(ret_conv, true);
24165 }
24166
24167 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
24168         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24169         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
24170         return tag_ptr(ret_conv, true);
24171 }
24172 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
24173         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
24174         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
24175         return ret_conv;
24176 }
24177
24178 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
24179         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
24180         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24181         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
24182         return tag_ptr(ret_conv, true);
24183 }
24184
24185 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
24186         void* a_ptr = untag_ptr(a);
24187         CHECK_ACCESS(a_ptr);
24188         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
24189         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
24190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24191                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
24192         }
24193         void* b_ptr = untag_ptr(b);
24194         CHECK_ACCESS(b_ptr);
24195         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24196         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24197         LDKBlindedPath c_conv;
24198         c_conv.inner = untag_ptr(c);
24199         c_conv.is_owned = ptr_is_owned(c);
24200         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24201         c_conv = BlindedPath_clone(&c_conv);
24202         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24203         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24204         return tag_ptr(ret_conv, true);
24205 }
24206
24207 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
24208         if (!ptr_is_owned(_res)) return;
24209         void* _res_ptr = untag_ptr(_res);
24210         CHECK_ACCESS(_res_ptr);
24211         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
24212         FREE(untag_ptr(_res));
24213         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
24214 }
24215
24216 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
24217         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
24218         _res_constr.datalen = _res->arr_len;
24219         if (_res_constr.datalen > 0)
24220                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
24221         else
24222                 _res_constr.data = NULL;
24223         uint64_t* _res_vals = _res->elems;
24224         for (size_t e = 0; e < _res_constr.datalen; e++) {
24225                 uint64_t _res_conv_56 = _res_vals[e];
24226                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
24227                 CHECK_ACCESS(_res_conv_56_ptr);
24228                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
24229                 FREE(untag_ptr(_res_conv_56));
24230                 _res_constr.data[e] = _res_conv_56_conv;
24231         }
24232         FREE(_res);
24233         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
24234 }
24235
24236 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
24237         void* o_ptr = untag_ptr(o);
24238         CHECK_ACCESS(o_ptr);
24239         LDKType o_conv = *(LDKType*)(o_ptr);
24240         if (o_conv.free == LDKType_JCalls_free) {
24241                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24242                 LDKType_JCalls_cloned(&o_conv);
24243         }
24244         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24245         *ret_copy = COption_TypeZ_some(o_conv);
24246         uint64_t ret_ref = tag_ptr(ret_copy, true);
24247         return ret_ref;
24248 }
24249
24250 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
24251         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24252         *ret_copy = COption_TypeZ_none();
24253         uint64_t ret_ref = tag_ptr(ret_copy, true);
24254         return ret_ref;
24255 }
24256
24257 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
24258         if (!ptr_is_owned(_res)) return;
24259         void* _res_ptr = untag_ptr(_res);
24260         CHECK_ACCESS(_res_ptr);
24261         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
24262         FREE(untag_ptr(_res));
24263         COption_TypeZ_free(_res_conv);
24264 }
24265
24266 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
24267         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24268         *ret_copy = COption_TypeZ_clone(arg);
24269         uint64_t ret_ref = tag_ptr(ret_copy, true);
24270         return ret_ref;
24271 }
24272 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
24273         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
24274         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
24275         return ret_conv;
24276 }
24277
24278 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
24279         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
24280         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24281         *ret_copy = COption_TypeZ_clone(orig_conv);
24282         uint64_t ret_ref = tag_ptr(ret_copy, true);
24283         return ret_ref;
24284 }
24285
24286 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
24287         void* o_ptr = untag_ptr(o);
24288         CHECK_ACCESS(o_ptr);
24289         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
24290         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
24291         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24292         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
24293         return tag_ptr(ret_conv, true);
24294 }
24295
24296 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
24297         void* e_ptr = untag_ptr(e);
24298         CHECK_ACCESS(e_ptr);
24299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24301         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24302         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
24303         return tag_ptr(ret_conv, true);
24304 }
24305
24306 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
24307         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
24308         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
24309         return ret_conv;
24310 }
24311
24312 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
24313         if (!ptr_is_owned(_res)) return;
24314         void* _res_ptr = untag_ptr(_res);
24315         CHECK_ACCESS(_res_ptr);
24316         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
24317         FREE(untag_ptr(_res));
24318         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
24319 }
24320
24321 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
24322         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24323         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
24324         return tag_ptr(ret_conv, true);
24325 }
24326 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
24327         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
24328         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
24329         return ret_conv;
24330 }
24331
24332 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
24333         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
24334         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24335         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
24336         return tag_ptr(ret_conv, true);
24337 }
24338
24339 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
24340         void* o_ptr = untag_ptr(o);
24341         CHECK_ACCESS(o_ptr);
24342         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
24343         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
24344         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24345         *ret_copy = COption_SocketAddressZ_some(o_conv);
24346         uint64_t ret_ref = tag_ptr(ret_copy, true);
24347         return ret_ref;
24348 }
24349
24350 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
24351         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24352         *ret_copy = COption_SocketAddressZ_none();
24353         uint64_t ret_ref = tag_ptr(ret_copy, true);
24354         return ret_ref;
24355 }
24356
24357 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
24358         if (!ptr_is_owned(_res)) return;
24359         void* _res_ptr = untag_ptr(_res);
24360         CHECK_ACCESS(_res_ptr);
24361         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
24362         FREE(untag_ptr(_res));
24363         COption_SocketAddressZ_free(_res_conv);
24364 }
24365
24366 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
24367         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24368         *ret_copy = COption_SocketAddressZ_clone(arg);
24369         uint64_t ret_ref = tag_ptr(ret_copy, true);
24370         return ret_ref;
24371 }
24372 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
24373         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
24374         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
24375         return ret_conv;
24376 }
24377
24378 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
24379         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
24380         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24381         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
24382         uint64_t ret_ref = tag_ptr(ret_copy, true);
24383         return ret_ref;
24384 }
24385
24386 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
24387         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24388         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
24389         return tag_ptr(ret_conv, true);
24390 }
24391 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(uint64_t arg) {
24392         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
24393         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
24394         return ret_conv;
24395 }
24396
24397 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(uint64_t orig) {
24398         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
24399         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24400         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
24401         return tag_ptr(ret_conv, true);
24402 }
24403
24404 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, uint64_t b) {
24405         LDKPublicKey a_ref;
24406         CHECK(a->arr_len == 33);
24407         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24408         void* b_ptr = untag_ptr(b);
24409         CHECK_ACCESS(b_ptr);
24410         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
24411         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
24412         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24413         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
24414         return tag_ptr(ret_conv, true);
24415 }
24416
24417 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(uint64_t _res) {
24418         if (!ptr_is_owned(_res)) return;
24419         void* _res_ptr = untag_ptr(_res);
24420         CHECK_ACCESS(_res_ptr);
24421         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
24422         FREE(untag_ptr(_res));
24423         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
24424 }
24425
24426 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(uint64_tArray _res) {
24427         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
24428         _res_constr.datalen = _res->arr_len;
24429         if (_res_constr.datalen > 0)
24430                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
24431         else
24432                 _res_constr.data = NULL;
24433         uint64_t* _res_vals = _res->elems;
24434         for (size_t r = 0; r < _res_constr.datalen; r++) {
24435                 uint64_t _res_conv_43 = _res_vals[r];
24436                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
24437                 CHECK_ACCESS(_res_conv_43_ptr);
24438                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
24439                 FREE(untag_ptr(_res_conv_43));
24440                 _res_constr.data[r] = _res_conv_43_conv;
24441         }
24442         FREE(_res);
24443         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
24444 }
24445
24446 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
24447         LDKCVec_u8Z o_ref;
24448         o_ref.datalen = o->arr_len;
24449         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24450         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24451         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24452         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
24453         return tag_ptr(ret_conv, true);
24454 }
24455
24456 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
24457         LDKPeerHandleError e_conv;
24458         e_conv.inner = untag_ptr(e);
24459         e_conv.is_owned = ptr_is_owned(e);
24460         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24461         e_conv = PeerHandleError_clone(&e_conv);
24462         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24463         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
24464         return tag_ptr(ret_conv, true);
24465 }
24466
24467 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
24468         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
24469         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
24470         return ret_conv;
24471 }
24472
24473 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
24474         if (!ptr_is_owned(_res)) return;
24475         void* _res_ptr = untag_ptr(_res);
24476         CHECK_ACCESS(_res_ptr);
24477         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
24478         FREE(untag_ptr(_res));
24479         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
24480 }
24481
24482 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
24483         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24484         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
24485         return tag_ptr(ret_conv, true);
24486 }
24487 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
24488         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
24489         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
24490         return ret_conv;
24491 }
24492
24493 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
24494         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
24495         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24496         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
24497         return tag_ptr(ret_conv, true);
24498 }
24499
24500 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
24501         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24502         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
24503         return tag_ptr(ret_conv, true);
24504 }
24505
24506 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
24507         LDKPeerHandleError e_conv;
24508         e_conv.inner = untag_ptr(e);
24509         e_conv.is_owned = ptr_is_owned(e);
24510         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24511         e_conv = PeerHandleError_clone(&e_conv);
24512         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24513         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
24514         return tag_ptr(ret_conv, true);
24515 }
24516
24517 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
24518         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
24519         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
24520         return ret_conv;
24521 }
24522
24523 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
24524         if (!ptr_is_owned(_res)) return;
24525         void* _res_ptr = untag_ptr(_res);
24526         CHECK_ACCESS(_res_ptr);
24527         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
24528         FREE(untag_ptr(_res));
24529         CResult_NonePeerHandleErrorZ_free(_res_conv);
24530 }
24531
24532 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
24533         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24534         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
24535         return tag_ptr(ret_conv, true);
24536 }
24537 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
24538         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
24539         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
24540         return ret_conv;
24541 }
24542
24543 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
24544         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
24545         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24546         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
24547         return tag_ptr(ret_conv, true);
24548 }
24549
24550 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
24551         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24552         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
24553         return tag_ptr(ret_conv, true);
24554 }
24555
24556 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
24557         LDKPeerHandleError e_conv;
24558         e_conv.inner = untag_ptr(e);
24559         e_conv.is_owned = ptr_is_owned(e);
24560         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24561         e_conv = PeerHandleError_clone(&e_conv);
24562         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24563         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
24564         return tag_ptr(ret_conv, true);
24565 }
24566
24567 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
24568         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
24569         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
24570         return ret_conv;
24571 }
24572
24573 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
24574         if (!ptr_is_owned(_res)) return;
24575         void* _res_ptr = untag_ptr(_res);
24576         CHECK_ACCESS(_res_ptr);
24577         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
24578         FREE(untag_ptr(_res));
24579         CResult_boolPeerHandleErrorZ_free(_res_conv);
24580 }
24581
24582 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
24583         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24584         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
24585         return tag_ptr(ret_conv, true);
24586 }
24587 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
24588         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
24589         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
24590         return ret_conv;
24591 }
24592
24593 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
24594         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
24595         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24596         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
24597         return tag_ptr(ret_conv, true);
24598 }
24599
24600 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
24601         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24602         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
24603         return tag_ptr(ret_conv, true);
24604 }
24605
24606 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
24607         void* e_ptr = untag_ptr(e);
24608         CHECK_ACCESS(e_ptr);
24609         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
24610         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
24611         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24612         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
24613         return tag_ptr(ret_conv, true);
24614 }
24615
24616 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
24617         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
24618         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
24619         return ret_conv;
24620 }
24621
24622 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
24623         if (!ptr_is_owned(_res)) return;
24624         void* _res_ptr = untag_ptr(_res);
24625         CHECK_ACCESS(_res_ptr);
24626         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
24627         FREE(untag_ptr(_res));
24628         CResult_u32GraphSyncErrorZ_free(_res_conv);
24629 }
24630
24631 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
24632         LDKCVec_u8Z o_ref;
24633         o_ref.datalen = o->arr_len;
24634         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24635         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24636         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24637         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
24638         return tag_ptr(ret_conv, true);
24639 }
24640
24641 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
24642         LDKIOError e_conv = LDKIOError_from_js(e);
24643         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24644         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
24645         return tag_ptr(ret_conv, true);
24646 }
24647
24648 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
24649         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
24650         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
24651         return ret_conv;
24652 }
24653
24654 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
24655         if (!ptr_is_owned(_res)) return;
24656         void* _res_ptr = untag_ptr(_res);
24657         CHECK_ACCESS(_res_ptr);
24658         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
24659         FREE(untag_ptr(_res));
24660         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
24661 }
24662
24663 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
24664         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24665         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
24666         return tag_ptr(ret_conv, true);
24667 }
24668 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
24669         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
24670         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
24671         return ret_conv;
24672 }
24673
24674 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
24675         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
24676         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24677         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
24678         return tag_ptr(ret_conv, true);
24679 }
24680
24681 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
24682         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24683         *ret_conv = CResult_NoneIOErrorZ_ok();
24684         return tag_ptr(ret_conv, true);
24685 }
24686
24687 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
24688         LDKIOError e_conv = LDKIOError_from_js(e);
24689         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24690         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
24691         return tag_ptr(ret_conv, true);
24692 }
24693
24694 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
24695         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
24696         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
24697         return ret_conv;
24698 }
24699
24700 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
24701         if (!ptr_is_owned(_res)) return;
24702         void* _res_ptr = untag_ptr(_res);
24703         CHECK_ACCESS(_res_ptr);
24704         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
24705         FREE(untag_ptr(_res));
24706         CResult_NoneIOErrorZ_free(_res_conv);
24707 }
24708
24709 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
24710         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24711         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
24712         return tag_ptr(ret_conv, true);
24713 }
24714 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
24715         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
24716         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
24717         return ret_conv;
24718 }
24719
24720 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
24721         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
24722         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24723         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
24724         return tag_ptr(ret_conv, true);
24725 }
24726
24727 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
24728         LDKCVec_StrZ _res_constr;
24729         _res_constr.datalen = _res->arr_len;
24730         if (_res_constr.datalen > 0)
24731                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
24732         else
24733                 _res_constr.data = NULL;
24734         jstring* _res_vals = (void*) _res->elems;
24735         for (size_t i = 0; i < _res_constr.datalen; i++) {
24736                 jstring _res_conv_8 = _res_vals[i];
24737                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
24738                 _res_constr.data[i] = dummy;
24739         }
24740         FREE(_res);
24741         CVec_StrZ_free(_res_constr);
24742 }
24743
24744 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
24745         LDKCVec_StrZ o_constr;
24746         o_constr.datalen = o->arr_len;
24747         if (o_constr.datalen > 0)
24748                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
24749         else
24750                 o_constr.data = NULL;
24751         jstring* o_vals = (void*) o->elems;
24752         for (size_t i = 0; i < o_constr.datalen; i++) {
24753                 jstring o_conv_8 = o_vals[i];
24754                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
24755                 o_constr.data[i] = o_conv_8_conv;
24756         }
24757         FREE(o);
24758         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24759         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
24760         return tag_ptr(ret_conv, true);
24761 }
24762
24763 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
24764         LDKIOError e_conv = LDKIOError_from_js(e);
24765         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24766         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
24767         return tag_ptr(ret_conv, true);
24768 }
24769
24770 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
24771         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
24772         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
24773         return ret_conv;
24774 }
24775
24776 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
24777         if (!ptr_is_owned(_res)) return;
24778         void* _res_ptr = untag_ptr(_res);
24779         CHECK_ACCESS(_res_ptr);
24780         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
24781         FREE(untag_ptr(_res));
24782         CResult_CVec_StrZIOErrorZ_free(_res_conv);
24783 }
24784
24785 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
24786         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24787         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
24788         return tag_ptr(ret_conv, true);
24789 }
24790 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
24791         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
24792         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
24793         return ret_conv;
24794 }
24795
24796 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
24797         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
24798         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24799         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
24800         return tag_ptr(ret_conv, true);
24801 }
24802
24803 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
24804         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
24805         _res_constr.datalen = _res->arr_len;
24806         if (_res_constr.datalen > 0)
24807                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
24808         else
24809                 _res_constr.data = NULL;
24810         uint64_t* _res_vals = _res->elems;
24811         for (size_t o = 0; o < _res_constr.datalen; o++) {
24812                 uint64_t _res_conv_40 = _res_vals[o];
24813                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24814                 CHECK_ACCESS(_res_conv_40_ptr);
24815                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
24816                 FREE(untag_ptr(_res_conv_40));
24817                 _res_constr.data[o] = _res_conv_40_conv;
24818         }
24819         FREE(_res);
24820         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
24821 }
24822
24823 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
24824         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
24825         o_constr.datalen = o->arr_len;
24826         if (o_constr.datalen > 0)
24827                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
24828         else
24829                 o_constr.data = NULL;
24830         uint64_t* o_vals = o->elems;
24831         for (size_t o = 0; o < o_constr.datalen; o++) {
24832                 uint64_t o_conv_40 = o_vals[o];
24833                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24834                 CHECK_ACCESS(o_conv_40_ptr);
24835                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
24836                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
24837                 o_constr.data[o] = o_conv_40_conv;
24838         }
24839         FREE(o);
24840         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24841         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
24842         return tag_ptr(ret_conv, true);
24843 }
24844
24845 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
24846         LDKIOError e_conv = LDKIOError_from_js(e);
24847         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24848         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
24849         return tag_ptr(ret_conv, true);
24850 }
24851
24852 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
24853         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
24854         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
24855         return ret_conv;
24856 }
24857
24858 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
24859         if (!ptr_is_owned(_res)) return;
24860         void* _res_ptr = untag_ptr(_res);
24861         CHECK_ACCESS(_res_ptr);
24862         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
24863         FREE(untag_ptr(_res));
24864         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
24865 }
24866
24867 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
24868         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24869         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
24870         return tag_ptr(ret_conv, true);
24871 }
24872 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
24873         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
24874         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
24875         return ret_conv;
24876 }
24877
24878 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
24879         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
24880         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24881         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
24882         return tag_ptr(ret_conv, true);
24883 }
24884
24885 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
24886         void* o_ptr = untag_ptr(o);
24887         CHECK_ACCESS(o_ptr);
24888         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
24889         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
24890         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24891         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
24892         return tag_ptr(ret_conv, true);
24893 }
24894
24895 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
24896         LDKIOError e_conv = LDKIOError_from_js(e);
24897         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24898         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
24899         return tag_ptr(ret_conv, true);
24900 }
24901
24902 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
24903         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
24904         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
24905         return ret_conv;
24906 }
24907
24908 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
24909         if (!ptr_is_owned(_res)) return;
24910         void* _res_ptr = untag_ptr(_res);
24911         CHECK_ACCESS(_res_ptr);
24912         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
24913         FREE(untag_ptr(_res));
24914         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
24915 }
24916
24917 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
24918         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24919         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
24920         return tag_ptr(ret_conv, true);
24921 }
24922 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
24923         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
24924         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
24925         return ret_conv;
24926 }
24927
24928 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
24929         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
24930         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24931         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
24932         return tag_ptr(ret_conv, true);
24933 }
24934
24935 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
24936         LDKSecretKey o_ref;
24937         CHECK(o->arr_len == 32);
24938         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
24939         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24940         *ret_copy = COption_SecretKeyZ_some(o_ref);
24941         uint64_t ret_ref = tag_ptr(ret_copy, true);
24942         return ret_ref;
24943 }
24944
24945 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
24946         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24947         *ret_copy = COption_SecretKeyZ_none();
24948         uint64_t ret_ref = tag_ptr(ret_copy, true);
24949         return ret_ref;
24950 }
24951
24952 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
24953         if (!ptr_is_owned(_res)) return;
24954         void* _res_ptr = untag_ptr(_res);
24955         CHECK_ACCESS(_res_ptr);
24956         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
24957         FREE(untag_ptr(_res));
24958         COption_SecretKeyZ_free(_res_conv);
24959 }
24960
24961 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
24962         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24963         *ret_copy = COption_SecretKeyZ_clone(arg);
24964         uint64_t ret_ref = tag_ptr(ret_copy, true);
24965         return ret_ref;
24966 }
24967 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
24968         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
24969         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
24970         return ret_conv;
24971 }
24972
24973 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
24974         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
24975         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24976         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
24977         uint64_t ret_ref = tag_ptr(ret_copy, true);
24978         return ret_ref;
24979 }
24980
24981 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
24982         LDKVerifiedInvoiceRequest o_conv;
24983         o_conv.inner = untag_ptr(o);
24984         o_conv.is_owned = ptr_is_owned(o);
24985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24986         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
24987         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
24988         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
24989         return tag_ptr(ret_conv, true);
24990 }
24991
24992 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
24993         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
24994         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
24995         return tag_ptr(ret_conv, true);
24996 }
24997
24998 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
24999         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
25000         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
25001         return ret_conv;
25002 }
25003
25004 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
25005         if (!ptr_is_owned(_res)) return;
25006         void* _res_ptr = untag_ptr(_res);
25007         CHECK_ACCESS(_res_ptr);
25008         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
25009         FREE(untag_ptr(_res));
25010         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
25011 }
25012
25013 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
25014         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25015         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
25016         return tag_ptr(ret_conv, true);
25017 }
25018 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
25019         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
25020         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
25021         return ret_conv;
25022 }
25023
25024 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
25025         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
25026         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25027         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
25028         return tag_ptr(ret_conv, true);
25029 }
25030
25031 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
25032         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
25033         return ret_conv;
25034 }
25035
25036 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
25037         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
25038         return ret_conv;
25039 }
25040
25041 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
25042         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
25043         COption_NoneZ_free(_res_conv);
25044 }
25045
25046 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
25047         LDKCVec_WitnessZ _res_constr;
25048         _res_constr.datalen = _res->arr_len;
25049         if (_res_constr.datalen > 0)
25050                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
25051         else
25052                 _res_constr.data = NULL;
25053         int8_tArray* _res_vals = (void*) _res->elems;
25054         for (size_t m = 0; m < _res_constr.datalen; m++) {
25055                 int8_tArray _res_conv_12 = _res_vals[m];
25056                 LDKWitness _res_conv_12_ref;
25057                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
25058                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
25059                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
25060                 _res_conv_12_ref.data_is_owned = true;
25061                 _res_constr.data[m] = _res_conv_12_ref;
25062         }
25063         FREE(_res);
25064         CVec_WitnessZ_free(_res_constr);
25065 }
25066
25067 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
25068         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25069         *ret_copy = COption_i64Z_some(o);
25070         uint64_t ret_ref = tag_ptr(ret_copy, true);
25071         return ret_ref;
25072 }
25073
25074 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
25075         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25076         *ret_copy = COption_i64Z_none();
25077         uint64_t ret_ref = tag_ptr(ret_copy, true);
25078         return ret_ref;
25079 }
25080
25081 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
25082         if (!ptr_is_owned(_res)) return;
25083         void* _res_ptr = untag_ptr(_res);
25084         CHECK_ACCESS(_res_ptr);
25085         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
25086         FREE(untag_ptr(_res));
25087         COption_i64Z_free(_res_conv);
25088 }
25089
25090 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
25091         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25092         *ret_copy = COption_i64Z_clone(arg);
25093         uint64_t ret_ref = tag_ptr(ret_copy, true);
25094         return ret_ref;
25095 }
25096 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
25097         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
25098         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
25099         return ret_conv;
25100 }
25101
25102 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
25103         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
25104         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25105         *ret_copy = COption_i64Z_clone(orig_conv);
25106         uint64_t ret_ref = tag_ptr(ret_copy, true);
25107         return ret_ref;
25108 }
25109
25110 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
25111         void* o_ptr = untag_ptr(o);
25112         CHECK_ACCESS(o_ptr);
25113         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25114         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25115         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25116         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
25117         return tag_ptr(ret_conv, true);
25118 }
25119
25120 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_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_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25126         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
25127         return tag_ptr(ret_conv, true);
25128 }
25129
25130 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
25131         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
25132         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
25133         return ret_conv;
25134 }
25135
25136 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_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_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
25141         FREE(untag_ptr(_res));
25142         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
25143 }
25144
25145 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
25146         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25147         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
25148         return tag_ptr(ret_conv, true);
25149 }
25150 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
25151         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
25152         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
25153         return ret_conv;
25154 }
25155
25156 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
25157         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
25158         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25159         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
25160         return tag_ptr(ret_conv, true);
25161 }
25162
25163 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
25164         void* o_ptr = untag_ptr(o);
25165         CHECK_ACCESS(o_ptr);
25166         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25167         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25168         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25169         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
25170         return tag_ptr(ret_conv, true);
25171 }
25172
25173 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
25174         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
25175         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25176         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
25177         return tag_ptr(ret_conv, true);
25178 }
25179
25180 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
25181         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
25182         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
25183         return ret_conv;
25184 }
25185
25186 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
25187         if (!ptr_is_owned(_res)) return;
25188         void* _res_ptr = untag_ptr(_res);
25189         CHECK_ACCESS(_res_ptr);
25190         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
25191         FREE(untag_ptr(_res));
25192         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
25193 }
25194
25195 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
25196         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25197         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
25198         return tag_ptr(ret_conv, true);
25199 }
25200 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
25201         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
25202         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
25203         return ret_conv;
25204 }
25205
25206 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
25207         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
25208         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25209         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
25210         return tag_ptr(ret_conv, true);
25211 }
25212
25213 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
25214         LDKCVec_UpdateAddHTLCZ _res_constr;
25215         _res_constr.datalen = _res->arr_len;
25216         if (_res_constr.datalen > 0)
25217                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
25218         else
25219                 _res_constr.data = NULL;
25220         uint64_t* _res_vals = _res->elems;
25221         for (size_t p = 0; p < _res_constr.datalen; p++) {
25222                 uint64_t _res_conv_15 = _res_vals[p];
25223                 LDKUpdateAddHTLC _res_conv_15_conv;
25224                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
25225                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
25226                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
25227                 _res_constr.data[p] = _res_conv_15_conv;
25228         }
25229         FREE(_res);
25230         CVec_UpdateAddHTLCZ_free(_res_constr);
25231 }
25232
25233 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
25234         LDKCVec_UpdateFulfillHTLCZ _res_constr;
25235         _res_constr.datalen = _res->arr_len;
25236         if (_res_constr.datalen > 0)
25237                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
25238         else
25239                 _res_constr.data = NULL;
25240         uint64_t* _res_vals = _res->elems;
25241         for (size_t t = 0; t < _res_constr.datalen; t++) {
25242                 uint64_t _res_conv_19 = _res_vals[t];
25243                 LDKUpdateFulfillHTLC _res_conv_19_conv;
25244                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25245                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25246                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25247                 _res_constr.data[t] = _res_conv_19_conv;
25248         }
25249         FREE(_res);
25250         CVec_UpdateFulfillHTLCZ_free(_res_constr);
25251 }
25252
25253 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
25254         LDKCVec_UpdateFailHTLCZ _res_constr;
25255         _res_constr.datalen = _res->arr_len;
25256         if (_res_constr.datalen > 0)
25257                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
25258         else
25259                 _res_constr.data = NULL;
25260         uint64_t* _res_vals = _res->elems;
25261         for (size_t q = 0; q < _res_constr.datalen; q++) {
25262                 uint64_t _res_conv_16 = _res_vals[q];
25263                 LDKUpdateFailHTLC _res_conv_16_conv;
25264                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25265                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25266                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25267                 _res_constr.data[q] = _res_conv_16_conv;
25268         }
25269         FREE(_res);
25270         CVec_UpdateFailHTLCZ_free(_res_constr);
25271 }
25272
25273 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
25274         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
25275         _res_constr.datalen = _res->arr_len;
25276         if (_res_constr.datalen > 0)
25277                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
25278         else
25279                 _res_constr.data = NULL;
25280         uint64_t* _res_vals = _res->elems;
25281         for (size_t z = 0; z < _res_constr.datalen; z++) {
25282                 uint64_t _res_conv_25 = _res_vals[z];
25283                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
25284                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
25285                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
25286                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
25287                 _res_constr.data[z] = _res_conv_25_conv;
25288         }
25289         FREE(_res);
25290         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
25291 }
25292
25293 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
25294         LDKAcceptChannel o_conv;
25295         o_conv.inner = untag_ptr(o);
25296         o_conv.is_owned = ptr_is_owned(o);
25297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25298         o_conv = AcceptChannel_clone(&o_conv);
25299         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25300         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
25301         return tag_ptr(ret_conv, true);
25302 }
25303
25304 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
25305         void* e_ptr = untag_ptr(e);
25306         CHECK_ACCESS(e_ptr);
25307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25309         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25310         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
25311         return tag_ptr(ret_conv, true);
25312 }
25313
25314 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
25315         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
25316         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
25317         return ret_conv;
25318 }
25319
25320 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
25321         if (!ptr_is_owned(_res)) return;
25322         void* _res_ptr = untag_ptr(_res);
25323         CHECK_ACCESS(_res_ptr);
25324         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
25325         FREE(untag_ptr(_res));
25326         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
25327 }
25328
25329 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
25330         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25331         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
25332         return tag_ptr(ret_conv, true);
25333 }
25334 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
25335         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
25336         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
25337         return ret_conv;
25338 }
25339
25340 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
25341         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
25342         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25343         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
25344         return tag_ptr(ret_conv, true);
25345 }
25346
25347 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
25348         LDKAcceptChannelV2 o_conv;
25349         o_conv.inner = untag_ptr(o);
25350         o_conv.is_owned = ptr_is_owned(o);
25351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25352         o_conv = AcceptChannelV2_clone(&o_conv);
25353         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25354         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
25355         return tag_ptr(ret_conv, true);
25356 }
25357
25358 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
25359         void* e_ptr = untag_ptr(e);
25360         CHECK_ACCESS(e_ptr);
25361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25363         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25364         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
25365         return tag_ptr(ret_conv, true);
25366 }
25367
25368 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
25369         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
25370         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
25371         return ret_conv;
25372 }
25373
25374 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
25375         if (!ptr_is_owned(_res)) return;
25376         void* _res_ptr = untag_ptr(_res);
25377         CHECK_ACCESS(_res_ptr);
25378         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
25379         FREE(untag_ptr(_res));
25380         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
25381 }
25382
25383 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
25384         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25385         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
25386         return tag_ptr(ret_conv, true);
25387 }
25388 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
25389         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
25390         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
25391         return ret_conv;
25392 }
25393
25394 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
25395         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
25396         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25397         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
25398         return tag_ptr(ret_conv, true);
25399 }
25400
25401 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_ok"))) TS_CResult_StfuDecodeErrorZ_ok(uint64_t o) {
25402         LDKStfu o_conv;
25403         o_conv.inner = untag_ptr(o);
25404         o_conv.is_owned = ptr_is_owned(o);
25405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25406         o_conv = Stfu_clone(&o_conv);
25407         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25408         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
25409         return tag_ptr(ret_conv, true);
25410 }
25411
25412 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_err"))) TS_CResult_StfuDecodeErrorZ_err(uint64_t e) {
25413         void* e_ptr = untag_ptr(e);
25414         CHECK_ACCESS(e_ptr);
25415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25417         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25418         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
25419         return tag_ptr(ret_conv, true);
25420 }
25421
25422 jboolean  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_is_ok"))) TS_CResult_StfuDecodeErrorZ_is_ok(uint64_t o) {
25423         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
25424         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
25425         return ret_conv;
25426 }
25427
25428 void  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_free"))) TS_CResult_StfuDecodeErrorZ_free(uint64_t _res) {
25429         if (!ptr_is_owned(_res)) return;
25430         void* _res_ptr = untag_ptr(_res);
25431         CHECK_ACCESS(_res_ptr);
25432         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
25433         FREE(untag_ptr(_res));
25434         CResult_StfuDecodeErrorZ_free(_res_conv);
25435 }
25436
25437 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
25438         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25439         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
25440         return tag_ptr(ret_conv, true);
25441 }
25442 int64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone_ptr"))) TS_CResult_StfuDecodeErrorZ_clone_ptr(uint64_t arg) {
25443         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
25444         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
25445         return ret_conv;
25446 }
25447
25448 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone"))) TS_CResult_StfuDecodeErrorZ_clone(uint64_t orig) {
25449         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
25450         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25451         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
25452         return tag_ptr(ret_conv, true);
25453 }
25454
25455 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_ok"))) TS_CResult_SpliceDecodeErrorZ_ok(uint64_t o) {
25456         LDKSplice o_conv;
25457         o_conv.inner = untag_ptr(o);
25458         o_conv.is_owned = ptr_is_owned(o);
25459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25460         o_conv = Splice_clone(&o_conv);
25461         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25462         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
25463         return tag_ptr(ret_conv, true);
25464 }
25465
25466 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_err"))) TS_CResult_SpliceDecodeErrorZ_err(uint64_t e) {
25467         void* e_ptr = untag_ptr(e);
25468         CHECK_ACCESS(e_ptr);
25469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25471         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25472         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
25473         return tag_ptr(ret_conv, true);
25474 }
25475
25476 jboolean  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_is_ok"))) TS_CResult_SpliceDecodeErrorZ_is_ok(uint64_t o) {
25477         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
25478         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
25479         return ret_conv;
25480 }
25481
25482 void  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_free"))) TS_CResult_SpliceDecodeErrorZ_free(uint64_t _res) {
25483         if (!ptr_is_owned(_res)) return;
25484         void* _res_ptr = untag_ptr(_res);
25485         CHECK_ACCESS(_res_ptr);
25486         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
25487         FREE(untag_ptr(_res));
25488         CResult_SpliceDecodeErrorZ_free(_res_conv);
25489 }
25490
25491 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
25492         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25493         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
25494         return tag_ptr(ret_conv, true);
25495 }
25496 int64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceDecodeErrorZ_clone_ptr(uint64_t arg) {
25497         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
25498         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
25499         return ret_conv;
25500 }
25501
25502 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone"))) TS_CResult_SpliceDecodeErrorZ_clone(uint64_t orig) {
25503         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
25504         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25505         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
25506         return tag_ptr(ret_conv, true);
25507 }
25508
25509 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_ok"))) TS_CResult_SpliceAckDecodeErrorZ_ok(uint64_t o) {
25510         LDKSpliceAck o_conv;
25511         o_conv.inner = untag_ptr(o);
25512         o_conv.is_owned = ptr_is_owned(o);
25513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25514         o_conv = SpliceAck_clone(&o_conv);
25515         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25516         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
25517         return tag_ptr(ret_conv, true);
25518 }
25519
25520 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_err"))) TS_CResult_SpliceAckDecodeErrorZ_err(uint64_t e) {
25521         void* e_ptr = untag_ptr(e);
25522         CHECK_ACCESS(e_ptr);
25523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25525         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25526         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
25527         return tag_ptr(ret_conv, true);
25528 }
25529
25530 jboolean  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_is_ok"))) TS_CResult_SpliceAckDecodeErrorZ_is_ok(uint64_t o) {
25531         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
25532         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
25533         return ret_conv;
25534 }
25535
25536 void  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_free"))) TS_CResult_SpliceAckDecodeErrorZ_free(uint64_t _res) {
25537         if (!ptr_is_owned(_res)) return;
25538         void* _res_ptr = untag_ptr(_res);
25539         CHECK_ACCESS(_res_ptr);
25540         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
25541         FREE(untag_ptr(_res));
25542         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
25543 }
25544
25545 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
25546         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25547         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
25548         return tag_ptr(ret_conv, true);
25549 }
25550 int64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceAckDecodeErrorZ_clone_ptr(uint64_t arg) {
25551         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
25552         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
25553         return ret_conv;
25554 }
25555
25556 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone"))) TS_CResult_SpliceAckDecodeErrorZ_clone(uint64_t orig) {
25557         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
25558         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25559         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
25560         return tag_ptr(ret_conv, true);
25561 }
25562
25563 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_ok(uint64_t o) {
25564         LDKSpliceLocked o_conv;
25565         o_conv.inner = untag_ptr(o);
25566         o_conv.is_owned = ptr_is_owned(o);
25567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25568         o_conv = SpliceLocked_clone(&o_conv);
25569         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25570         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
25571         return tag_ptr(ret_conv, true);
25572 }
25573
25574 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_err"))) TS_CResult_SpliceLockedDecodeErrorZ_err(uint64_t e) {
25575         void* e_ptr = untag_ptr(e);
25576         CHECK_ACCESS(e_ptr);
25577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25579         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25580         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
25581         return tag_ptr(ret_conv, true);
25582 }
25583
25584 jboolean  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_is_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_is_ok(uint64_t o) {
25585         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
25586         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
25587         return ret_conv;
25588 }
25589
25590 void  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_free"))) TS_CResult_SpliceLockedDecodeErrorZ_free(uint64_t _res) {
25591         if (!ptr_is_owned(_res)) return;
25592         void* _res_ptr = untag_ptr(_res);
25593         CHECK_ACCESS(_res_ptr);
25594         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
25595         FREE(untag_ptr(_res));
25596         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
25597 }
25598
25599 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
25600         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25601         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
25602         return tag_ptr(ret_conv, true);
25603 }
25604 int64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr(uint64_t arg) {
25605         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
25606         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
25607         return ret_conv;
25608 }
25609
25610 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone"))) TS_CResult_SpliceLockedDecodeErrorZ_clone(uint64_t orig) {
25611         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
25612         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25613         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
25614         return tag_ptr(ret_conv, true);
25615 }
25616
25617 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
25618         LDKTxAddInput o_conv;
25619         o_conv.inner = untag_ptr(o);
25620         o_conv.is_owned = ptr_is_owned(o);
25621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25622         o_conv = TxAddInput_clone(&o_conv);
25623         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25624         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
25625         return tag_ptr(ret_conv, true);
25626 }
25627
25628 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
25629         void* e_ptr = untag_ptr(e);
25630         CHECK_ACCESS(e_ptr);
25631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25633         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25634         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
25635         return tag_ptr(ret_conv, true);
25636 }
25637
25638 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
25639         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
25640         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
25641         return ret_conv;
25642 }
25643
25644 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
25645         if (!ptr_is_owned(_res)) return;
25646         void* _res_ptr = untag_ptr(_res);
25647         CHECK_ACCESS(_res_ptr);
25648         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
25649         FREE(untag_ptr(_res));
25650         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
25651 }
25652
25653 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
25654         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25655         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
25656         return tag_ptr(ret_conv, true);
25657 }
25658 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
25659         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
25660         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
25661         return ret_conv;
25662 }
25663
25664 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
25665         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
25666         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25667         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
25668         return tag_ptr(ret_conv, true);
25669 }
25670
25671 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
25672         LDKTxAddOutput o_conv;
25673         o_conv.inner = untag_ptr(o);
25674         o_conv.is_owned = ptr_is_owned(o);
25675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25676         o_conv = TxAddOutput_clone(&o_conv);
25677         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25678         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
25679         return tag_ptr(ret_conv, true);
25680 }
25681
25682 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
25683         void* e_ptr = untag_ptr(e);
25684         CHECK_ACCESS(e_ptr);
25685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25687         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25688         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
25689         return tag_ptr(ret_conv, true);
25690 }
25691
25692 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
25693         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
25694         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
25695         return ret_conv;
25696 }
25697
25698 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
25699         if (!ptr_is_owned(_res)) return;
25700         void* _res_ptr = untag_ptr(_res);
25701         CHECK_ACCESS(_res_ptr);
25702         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
25703         FREE(untag_ptr(_res));
25704         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
25705 }
25706
25707 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
25708         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25709         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
25710         return tag_ptr(ret_conv, true);
25711 }
25712 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
25713         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
25714         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
25715         return ret_conv;
25716 }
25717
25718 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
25719         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
25720         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25721         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
25722         return tag_ptr(ret_conv, true);
25723 }
25724
25725 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
25726         LDKTxRemoveInput o_conv;
25727         o_conv.inner = untag_ptr(o);
25728         o_conv.is_owned = ptr_is_owned(o);
25729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25730         o_conv = TxRemoveInput_clone(&o_conv);
25731         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25732         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
25733         return tag_ptr(ret_conv, true);
25734 }
25735
25736 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
25737         void* e_ptr = untag_ptr(e);
25738         CHECK_ACCESS(e_ptr);
25739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25741         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25742         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
25743         return tag_ptr(ret_conv, true);
25744 }
25745
25746 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
25747         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
25748         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
25749         return ret_conv;
25750 }
25751
25752 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
25753         if (!ptr_is_owned(_res)) return;
25754         void* _res_ptr = untag_ptr(_res);
25755         CHECK_ACCESS(_res_ptr);
25756         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
25757         FREE(untag_ptr(_res));
25758         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
25759 }
25760
25761 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
25762         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25763         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
25764         return tag_ptr(ret_conv, true);
25765 }
25766 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
25767         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
25768         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
25769         return ret_conv;
25770 }
25771
25772 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
25773         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
25774         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25775         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
25776         return tag_ptr(ret_conv, true);
25777 }
25778
25779 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
25780         LDKTxRemoveOutput o_conv;
25781         o_conv.inner = untag_ptr(o);
25782         o_conv.is_owned = ptr_is_owned(o);
25783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25784         o_conv = TxRemoveOutput_clone(&o_conv);
25785         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25786         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
25787         return tag_ptr(ret_conv, true);
25788 }
25789
25790 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
25791         void* e_ptr = untag_ptr(e);
25792         CHECK_ACCESS(e_ptr);
25793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25795         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25796         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
25797         return tag_ptr(ret_conv, true);
25798 }
25799
25800 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
25801         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
25802         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
25803         return ret_conv;
25804 }
25805
25806 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
25807         if (!ptr_is_owned(_res)) return;
25808         void* _res_ptr = untag_ptr(_res);
25809         CHECK_ACCESS(_res_ptr);
25810         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
25811         FREE(untag_ptr(_res));
25812         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
25813 }
25814
25815 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
25816         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25817         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
25818         return tag_ptr(ret_conv, true);
25819 }
25820 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
25821         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
25822         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
25823         return ret_conv;
25824 }
25825
25826 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
25827         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
25828         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25829         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
25830         return tag_ptr(ret_conv, true);
25831 }
25832
25833 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
25834         LDKTxComplete o_conv;
25835         o_conv.inner = untag_ptr(o);
25836         o_conv.is_owned = ptr_is_owned(o);
25837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25838         o_conv = TxComplete_clone(&o_conv);
25839         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25840         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
25841         return tag_ptr(ret_conv, true);
25842 }
25843
25844 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
25845         void* e_ptr = untag_ptr(e);
25846         CHECK_ACCESS(e_ptr);
25847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25849         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25850         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
25851         return tag_ptr(ret_conv, true);
25852 }
25853
25854 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
25855         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
25856         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
25857         return ret_conv;
25858 }
25859
25860 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
25861         if (!ptr_is_owned(_res)) return;
25862         void* _res_ptr = untag_ptr(_res);
25863         CHECK_ACCESS(_res_ptr);
25864         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
25865         FREE(untag_ptr(_res));
25866         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
25867 }
25868
25869 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
25870         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25871         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
25872         return tag_ptr(ret_conv, true);
25873 }
25874 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
25875         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
25876         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
25877         return ret_conv;
25878 }
25879
25880 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
25881         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
25882         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25883         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
25884         return tag_ptr(ret_conv, true);
25885 }
25886
25887 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
25888         LDKTxSignatures o_conv;
25889         o_conv.inner = untag_ptr(o);
25890         o_conv.is_owned = ptr_is_owned(o);
25891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25892         o_conv = TxSignatures_clone(&o_conv);
25893         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25894         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
25895         return tag_ptr(ret_conv, true);
25896 }
25897
25898 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
25899         void* e_ptr = untag_ptr(e);
25900         CHECK_ACCESS(e_ptr);
25901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25903         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25904         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
25905         return tag_ptr(ret_conv, true);
25906 }
25907
25908 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
25909         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
25910         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
25911         return ret_conv;
25912 }
25913
25914 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
25915         if (!ptr_is_owned(_res)) return;
25916         void* _res_ptr = untag_ptr(_res);
25917         CHECK_ACCESS(_res_ptr);
25918         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
25919         FREE(untag_ptr(_res));
25920         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
25921 }
25922
25923 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
25924         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25925         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
25926         return tag_ptr(ret_conv, true);
25927 }
25928 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
25929         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
25930         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
25931         return ret_conv;
25932 }
25933
25934 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
25935         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
25936         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25937         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
25938         return tag_ptr(ret_conv, true);
25939 }
25940
25941 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
25942         LDKTxInitRbf o_conv;
25943         o_conv.inner = untag_ptr(o);
25944         o_conv.is_owned = ptr_is_owned(o);
25945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25946         o_conv = TxInitRbf_clone(&o_conv);
25947         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25948         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
25949         return tag_ptr(ret_conv, true);
25950 }
25951
25952 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
25953         void* e_ptr = untag_ptr(e);
25954         CHECK_ACCESS(e_ptr);
25955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25957         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25958         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
25959         return tag_ptr(ret_conv, true);
25960 }
25961
25962 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
25963         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
25964         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
25965         return ret_conv;
25966 }
25967
25968 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
25969         if (!ptr_is_owned(_res)) return;
25970         void* _res_ptr = untag_ptr(_res);
25971         CHECK_ACCESS(_res_ptr);
25972         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
25973         FREE(untag_ptr(_res));
25974         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
25975 }
25976
25977 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
25978         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25979         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
25980         return tag_ptr(ret_conv, true);
25981 }
25982 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
25983         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
25984         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
25985         return ret_conv;
25986 }
25987
25988 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
25989         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
25990         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25991         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
25992         return tag_ptr(ret_conv, true);
25993 }
25994
25995 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
25996         LDKTxAckRbf o_conv;
25997         o_conv.inner = untag_ptr(o);
25998         o_conv.is_owned = ptr_is_owned(o);
25999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26000         o_conv = TxAckRbf_clone(&o_conv);
26001         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26002         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
26003         return tag_ptr(ret_conv, true);
26004 }
26005
26006 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
26007         void* e_ptr = untag_ptr(e);
26008         CHECK_ACCESS(e_ptr);
26009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26011         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26012         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
26013         return tag_ptr(ret_conv, true);
26014 }
26015
26016 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
26017         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
26018         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
26019         return ret_conv;
26020 }
26021
26022 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
26023         if (!ptr_is_owned(_res)) return;
26024         void* _res_ptr = untag_ptr(_res);
26025         CHECK_ACCESS(_res_ptr);
26026         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
26027         FREE(untag_ptr(_res));
26028         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
26029 }
26030
26031 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
26032         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26033         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
26034         return tag_ptr(ret_conv, true);
26035 }
26036 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
26037         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
26038         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
26039         return ret_conv;
26040 }
26041
26042 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
26043         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
26044         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26045         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
26046         return tag_ptr(ret_conv, true);
26047 }
26048
26049 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
26050         LDKTxAbort o_conv;
26051         o_conv.inner = untag_ptr(o);
26052         o_conv.is_owned = ptr_is_owned(o);
26053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26054         o_conv = TxAbort_clone(&o_conv);
26055         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26056         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
26057         return tag_ptr(ret_conv, true);
26058 }
26059
26060 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
26061         void* e_ptr = untag_ptr(e);
26062         CHECK_ACCESS(e_ptr);
26063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26065         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26066         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
26067         return tag_ptr(ret_conv, true);
26068 }
26069
26070 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
26071         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
26072         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
26073         return ret_conv;
26074 }
26075
26076 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
26077         if (!ptr_is_owned(_res)) return;
26078         void* _res_ptr = untag_ptr(_res);
26079         CHECK_ACCESS(_res_ptr);
26080         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
26081         FREE(untag_ptr(_res));
26082         CResult_TxAbortDecodeErrorZ_free(_res_conv);
26083 }
26084
26085 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
26086         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26087         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
26088         return tag_ptr(ret_conv, true);
26089 }
26090 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
26091         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
26092         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
26093         return ret_conv;
26094 }
26095
26096 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
26097         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
26098         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26099         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
26100         return tag_ptr(ret_conv, true);
26101 }
26102
26103 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
26104         LDKAnnouncementSignatures o_conv;
26105         o_conv.inner = untag_ptr(o);
26106         o_conv.is_owned = ptr_is_owned(o);
26107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26108         o_conv = AnnouncementSignatures_clone(&o_conv);
26109         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26110         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
26111         return tag_ptr(ret_conv, true);
26112 }
26113
26114 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
26115         void* e_ptr = untag_ptr(e);
26116         CHECK_ACCESS(e_ptr);
26117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26119         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26120         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
26121         return tag_ptr(ret_conv, true);
26122 }
26123
26124 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
26125         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
26126         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
26127         return ret_conv;
26128 }
26129
26130 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
26131         if (!ptr_is_owned(_res)) return;
26132         void* _res_ptr = untag_ptr(_res);
26133         CHECK_ACCESS(_res_ptr);
26134         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
26135         FREE(untag_ptr(_res));
26136         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
26137 }
26138
26139 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
26140         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26141         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
26142         return tag_ptr(ret_conv, true);
26143 }
26144 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
26145         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
26146         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
26147         return ret_conv;
26148 }
26149
26150 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
26151         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
26152         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26153         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
26154         return tag_ptr(ret_conv, true);
26155 }
26156
26157 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
26158         LDKChannelReestablish o_conv;
26159         o_conv.inner = untag_ptr(o);
26160         o_conv.is_owned = ptr_is_owned(o);
26161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26162         o_conv = ChannelReestablish_clone(&o_conv);
26163         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26164         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
26165         return tag_ptr(ret_conv, true);
26166 }
26167
26168 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
26169         void* e_ptr = untag_ptr(e);
26170         CHECK_ACCESS(e_ptr);
26171         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26172         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26173         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26174         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
26175         return tag_ptr(ret_conv, true);
26176 }
26177
26178 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
26179         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
26180         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
26181         return ret_conv;
26182 }
26183
26184 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
26185         if (!ptr_is_owned(_res)) return;
26186         void* _res_ptr = untag_ptr(_res);
26187         CHECK_ACCESS(_res_ptr);
26188         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
26189         FREE(untag_ptr(_res));
26190         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
26191 }
26192
26193 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
26194         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26195         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
26196         return tag_ptr(ret_conv, true);
26197 }
26198 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
26199         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
26200         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
26201         return ret_conv;
26202 }
26203
26204 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
26205         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
26206         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26207         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
26208         return tag_ptr(ret_conv, true);
26209 }
26210
26211 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
26212         LDKClosingSigned o_conv;
26213         o_conv.inner = untag_ptr(o);
26214         o_conv.is_owned = ptr_is_owned(o);
26215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26216         o_conv = ClosingSigned_clone(&o_conv);
26217         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26218         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
26219         return tag_ptr(ret_conv, true);
26220 }
26221
26222 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
26223         void* e_ptr = untag_ptr(e);
26224         CHECK_ACCESS(e_ptr);
26225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26227         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26228         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
26229         return tag_ptr(ret_conv, true);
26230 }
26231
26232 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
26233         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
26234         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
26235         return ret_conv;
26236 }
26237
26238 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
26239         if (!ptr_is_owned(_res)) return;
26240         void* _res_ptr = untag_ptr(_res);
26241         CHECK_ACCESS(_res_ptr);
26242         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
26243         FREE(untag_ptr(_res));
26244         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
26245 }
26246
26247 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
26248         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26249         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
26250         return tag_ptr(ret_conv, true);
26251 }
26252 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
26253         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
26254         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
26255         return ret_conv;
26256 }
26257
26258 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
26259         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
26260         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26261         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
26262         return tag_ptr(ret_conv, true);
26263 }
26264
26265 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
26266         LDKClosingSignedFeeRange o_conv;
26267         o_conv.inner = untag_ptr(o);
26268         o_conv.is_owned = ptr_is_owned(o);
26269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26270         o_conv = ClosingSignedFeeRange_clone(&o_conv);
26271         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26272         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
26273         return tag_ptr(ret_conv, true);
26274 }
26275
26276 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
26277         void* e_ptr = untag_ptr(e);
26278         CHECK_ACCESS(e_ptr);
26279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26281         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26282         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
26283         return tag_ptr(ret_conv, true);
26284 }
26285
26286 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
26287         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
26288         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
26289         return ret_conv;
26290 }
26291
26292 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
26293         if (!ptr_is_owned(_res)) return;
26294         void* _res_ptr = untag_ptr(_res);
26295         CHECK_ACCESS(_res_ptr);
26296         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
26297         FREE(untag_ptr(_res));
26298         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
26299 }
26300
26301 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
26302         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26303         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
26304         return tag_ptr(ret_conv, true);
26305 }
26306 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26307         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
26308         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
26309         return ret_conv;
26310 }
26311
26312 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
26313         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
26314         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26315         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
26316         return tag_ptr(ret_conv, true);
26317 }
26318
26319 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
26320         LDKCommitmentSigned o_conv;
26321         o_conv.inner = untag_ptr(o);
26322         o_conv.is_owned = ptr_is_owned(o);
26323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26324         o_conv = CommitmentSigned_clone(&o_conv);
26325         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26326         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
26327         return tag_ptr(ret_conv, true);
26328 }
26329
26330 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
26331         void* e_ptr = untag_ptr(e);
26332         CHECK_ACCESS(e_ptr);
26333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26335         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26336         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
26337         return tag_ptr(ret_conv, true);
26338 }
26339
26340 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
26341         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
26342         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
26343         return ret_conv;
26344 }
26345
26346 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
26347         if (!ptr_is_owned(_res)) return;
26348         void* _res_ptr = untag_ptr(_res);
26349         CHECK_ACCESS(_res_ptr);
26350         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
26351         FREE(untag_ptr(_res));
26352         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
26353 }
26354
26355 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
26356         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26357         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
26358         return tag_ptr(ret_conv, true);
26359 }
26360 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
26361         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
26362         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
26363         return ret_conv;
26364 }
26365
26366 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
26367         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
26368         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26369         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
26370         return tag_ptr(ret_conv, true);
26371 }
26372
26373 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
26374         LDKFundingCreated o_conv;
26375         o_conv.inner = untag_ptr(o);
26376         o_conv.is_owned = ptr_is_owned(o);
26377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26378         o_conv = FundingCreated_clone(&o_conv);
26379         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26380         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
26381         return tag_ptr(ret_conv, true);
26382 }
26383
26384 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
26385         void* e_ptr = untag_ptr(e);
26386         CHECK_ACCESS(e_ptr);
26387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26389         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26390         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
26391         return tag_ptr(ret_conv, true);
26392 }
26393
26394 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
26395         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
26396         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
26397         return ret_conv;
26398 }
26399
26400 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
26401         if (!ptr_is_owned(_res)) return;
26402         void* _res_ptr = untag_ptr(_res);
26403         CHECK_ACCESS(_res_ptr);
26404         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
26405         FREE(untag_ptr(_res));
26406         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
26407 }
26408
26409 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
26410         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26411         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
26412         return tag_ptr(ret_conv, true);
26413 }
26414 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
26415         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
26416         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
26417         return ret_conv;
26418 }
26419
26420 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
26421         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
26422         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26423         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
26424         return tag_ptr(ret_conv, true);
26425 }
26426
26427 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
26428         LDKFundingSigned o_conv;
26429         o_conv.inner = untag_ptr(o);
26430         o_conv.is_owned = ptr_is_owned(o);
26431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26432         o_conv = FundingSigned_clone(&o_conv);
26433         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26434         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
26435         return tag_ptr(ret_conv, true);
26436 }
26437
26438 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
26439         void* e_ptr = untag_ptr(e);
26440         CHECK_ACCESS(e_ptr);
26441         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26442         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26443         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26444         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
26445         return tag_ptr(ret_conv, true);
26446 }
26447
26448 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
26449         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
26450         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
26451         return ret_conv;
26452 }
26453
26454 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
26455         if (!ptr_is_owned(_res)) return;
26456         void* _res_ptr = untag_ptr(_res);
26457         CHECK_ACCESS(_res_ptr);
26458         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
26459         FREE(untag_ptr(_res));
26460         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
26461 }
26462
26463 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
26464         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26465         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
26466         return tag_ptr(ret_conv, true);
26467 }
26468 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
26469         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
26470         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
26471         return ret_conv;
26472 }
26473
26474 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
26475         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
26476         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26477         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
26478         return tag_ptr(ret_conv, true);
26479 }
26480
26481 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
26482         LDKChannelReady o_conv;
26483         o_conv.inner = untag_ptr(o);
26484         o_conv.is_owned = ptr_is_owned(o);
26485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26486         o_conv = ChannelReady_clone(&o_conv);
26487         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26488         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
26489         return tag_ptr(ret_conv, true);
26490 }
26491
26492 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
26493         void* e_ptr = untag_ptr(e);
26494         CHECK_ACCESS(e_ptr);
26495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26497         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26498         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
26499         return tag_ptr(ret_conv, true);
26500 }
26501
26502 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
26503         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
26504         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
26505         return ret_conv;
26506 }
26507
26508 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
26509         if (!ptr_is_owned(_res)) return;
26510         void* _res_ptr = untag_ptr(_res);
26511         CHECK_ACCESS(_res_ptr);
26512         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
26513         FREE(untag_ptr(_res));
26514         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
26515 }
26516
26517 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
26518         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26519         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
26520         return tag_ptr(ret_conv, true);
26521 }
26522 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
26523         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
26524         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
26525         return ret_conv;
26526 }
26527
26528 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
26529         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
26530         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26531         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
26532         return tag_ptr(ret_conv, true);
26533 }
26534
26535 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
26536         LDKInit o_conv;
26537         o_conv.inner = untag_ptr(o);
26538         o_conv.is_owned = ptr_is_owned(o);
26539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26540         o_conv = Init_clone(&o_conv);
26541         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26542         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
26543         return tag_ptr(ret_conv, true);
26544 }
26545
26546 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
26547         void* e_ptr = untag_ptr(e);
26548         CHECK_ACCESS(e_ptr);
26549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26551         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26552         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
26553         return tag_ptr(ret_conv, true);
26554 }
26555
26556 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
26557         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
26558         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
26559         return ret_conv;
26560 }
26561
26562 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
26563         if (!ptr_is_owned(_res)) return;
26564         void* _res_ptr = untag_ptr(_res);
26565         CHECK_ACCESS(_res_ptr);
26566         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
26567         FREE(untag_ptr(_res));
26568         CResult_InitDecodeErrorZ_free(_res_conv);
26569 }
26570
26571 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
26572         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26573         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
26574         return tag_ptr(ret_conv, true);
26575 }
26576 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
26577         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
26578         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
26579         return ret_conv;
26580 }
26581
26582 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
26583         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
26584         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26585         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
26586         return tag_ptr(ret_conv, true);
26587 }
26588
26589 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
26590         LDKOpenChannel o_conv;
26591         o_conv.inner = untag_ptr(o);
26592         o_conv.is_owned = ptr_is_owned(o);
26593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26594         o_conv = OpenChannel_clone(&o_conv);
26595         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26596         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
26597         return tag_ptr(ret_conv, true);
26598 }
26599
26600 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
26601         void* e_ptr = untag_ptr(e);
26602         CHECK_ACCESS(e_ptr);
26603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26605         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26606         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
26607         return tag_ptr(ret_conv, true);
26608 }
26609
26610 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
26611         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
26612         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
26613         return ret_conv;
26614 }
26615
26616 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
26617         if (!ptr_is_owned(_res)) return;
26618         void* _res_ptr = untag_ptr(_res);
26619         CHECK_ACCESS(_res_ptr);
26620         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
26621         FREE(untag_ptr(_res));
26622         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
26623 }
26624
26625 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
26626         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26627         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
26628         return tag_ptr(ret_conv, true);
26629 }
26630 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
26631         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
26632         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
26633         return ret_conv;
26634 }
26635
26636 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
26637         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
26638         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26639         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
26640         return tag_ptr(ret_conv, true);
26641 }
26642
26643 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
26644         LDKOpenChannelV2 o_conv;
26645         o_conv.inner = untag_ptr(o);
26646         o_conv.is_owned = ptr_is_owned(o);
26647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26648         o_conv = OpenChannelV2_clone(&o_conv);
26649         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26650         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
26651         return tag_ptr(ret_conv, true);
26652 }
26653
26654 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
26655         void* e_ptr = untag_ptr(e);
26656         CHECK_ACCESS(e_ptr);
26657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26659         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26660         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
26661         return tag_ptr(ret_conv, true);
26662 }
26663
26664 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
26665         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
26666         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
26667         return ret_conv;
26668 }
26669
26670 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
26671         if (!ptr_is_owned(_res)) return;
26672         void* _res_ptr = untag_ptr(_res);
26673         CHECK_ACCESS(_res_ptr);
26674         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
26675         FREE(untag_ptr(_res));
26676         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
26677 }
26678
26679 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
26680         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26681         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
26682         return tag_ptr(ret_conv, true);
26683 }
26684 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
26685         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
26686         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
26687         return ret_conv;
26688 }
26689
26690 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
26691         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
26692         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26693         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
26694         return tag_ptr(ret_conv, true);
26695 }
26696
26697 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
26698         LDKRevokeAndACK 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 = RevokeAndACK_clone(&o_conv);
26703         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26704         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
26705         return tag_ptr(ret_conv, true);
26706 }
26707
26708 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_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_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26714         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
26715         return tag_ptr(ret_conv, true);
26716 }
26717
26718 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
26719         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
26720         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
26721         return ret_conv;
26722 }
26723
26724 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_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_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
26729         FREE(untag_ptr(_res));
26730         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
26731 }
26732
26733 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
26734         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26735         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
26736         return tag_ptr(ret_conv, true);
26737 }
26738 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
26739         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
26740         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
26741         return ret_conv;
26742 }
26743
26744 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
26745         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
26746         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26747         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
26748         return tag_ptr(ret_conv, true);
26749 }
26750
26751 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
26752         LDKShutdown 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         o_conv = Shutdown_clone(&o_conv);
26757         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26758         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
26759         return tag_ptr(ret_conv, true);
26760 }
26761
26762 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
26763         void* e_ptr = untag_ptr(e);
26764         CHECK_ACCESS(e_ptr);
26765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26767         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26768         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
26769         return tag_ptr(ret_conv, true);
26770 }
26771
26772 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
26773         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
26774         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
26775         return ret_conv;
26776 }
26777
26778 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
26779         if (!ptr_is_owned(_res)) return;
26780         void* _res_ptr = untag_ptr(_res);
26781         CHECK_ACCESS(_res_ptr);
26782         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
26783         FREE(untag_ptr(_res));
26784         CResult_ShutdownDecodeErrorZ_free(_res_conv);
26785 }
26786
26787 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
26788         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26789         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
26790         return tag_ptr(ret_conv, true);
26791 }
26792 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
26793         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
26794         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
26795         return ret_conv;
26796 }
26797
26798 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
26799         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
26800         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26801         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
26802         return tag_ptr(ret_conv, true);
26803 }
26804
26805 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
26806         LDKUpdateFailHTLC o_conv;
26807         o_conv.inner = untag_ptr(o);
26808         o_conv.is_owned = ptr_is_owned(o);
26809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26810         o_conv = UpdateFailHTLC_clone(&o_conv);
26811         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26812         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
26813         return tag_ptr(ret_conv, true);
26814 }
26815
26816 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
26817         void* e_ptr = untag_ptr(e);
26818         CHECK_ACCESS(e_ptr);
26819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26821         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26822         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
26823         return tag_ptr(ret_conv, true);
26824 }
26825
26826 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
26827         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
26828         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
26829         return ret_conv;
26830 }
26831
26832 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
26833         if (!ptr_is_owned(_res)) return;
26834         void* _res_ptr = untag_ptr(_res);
26835         CHECK_ACCESS(_res_ptr);
26836         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
26837         FREE(untag_ptr(_res));
26838         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
26839 }
26840
26841 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
26842         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26843         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
26844         return tag_ptr(ret_conv, true);
26845 }
26846 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
26847         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
26848         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
26849         return ret_conv;
26850 }
26851
26852 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
26853         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
26854         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26855         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
26856         return tag_ptr(ret_conv, true);
26857 }
26858
26859 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
26860         LDKUpdateFailMalformedHTLC o_conv;
26861         o_conv.inner = untag_ptr(o);
26862         o_conv.is_owned = ptr_is_owned(o);
26863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26864         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
26865         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26866         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
26867         return tag_ptr(ret_conv, true);
26868 }
26869
26870 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
26871         void* e_ptr = untag_ptr(e);
26872         CHECK_ACCESS(e_ptr);
26873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26875         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26876         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
26877         return tag_ptr(ret_conv, true);
26878 }
26879
26880 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
26881         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
26882         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
26883         return ret_conv;
26884 }
26885
26886 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
26887         if (!ptr_is_owned(_res)) return;
26888         void* _res_ptr = untag_ptr(_res);
26889         CHECK_ACCESS(_res_ptr);
26890         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
26891         FREE(untag_ptr(_res));
26892         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
26893 }
26894
26895 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
26896         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26897         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
26898         return tag_ptr(ret_conv, true);
26899 }
26900 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
26901         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
26902         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
26903         return ret_conv;
26904 }
26905
26906 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
26907         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
26908         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26909         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
26910         return tag_ptr(ret_conv, true);
26911 }
26912
26913 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
26914         LDKUpdateFee o_conv;
26915         o_conv.inner = untag_ptr(o);
26916         o_conv.is_owned = ptr_is_owned(o);
26917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26918         o_conv = UpdateFee_clone(&o_conv);
26919         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26920         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
26921         return tag_ptr(ret_conv, true);
26922 }
26923
26924 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
26925         void* e_ptr = untag_ptr(e);
26926         CHECK_ACCESS(e_ptr);
26927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26929         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26930         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
26931         return tag_ptr(ret_conv, true);
26932 }
26933
26934 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
26935         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
26936         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
26937         return ret_conv;
26938 }
26939
26940 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
26941         if (!ptr_is_owned(_res)) return;
26942         void* _res_ptr = untag_ptr(_res);
26943         CHECK_ACCESS(_res_ptr);
26944         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
26945         FREE(untag_ptr(_res));
26946         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
26947 }
26948
26949 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
26950         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26951         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
26952         return tag_ptr(ret_conv, true);
26953 }
26954 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
26955         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
26956         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
26957         return ret_conv;
26958 }
26959
26960 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
26961         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
26962         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26963         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
26964         return tag_ptr(ret_conv, true);
26965 }
26966
26967 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
26968         LDKUpdateFulfillHTLC o_conv;
26969         o_conv.inner = untag_ptr(o);
26970         o_conv.is_owned = ptr_is_owned(o);
26971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26972         o_conv = UpdateFulfillHTLC_clone(&o_conv);
26973         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
26974         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
26975         return tag_ptr(ret_conv, true);
26976 }
26977
26978 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
26979         void* e_ptr = untag_ptr(e);
26980         CHECK_ACCESS(e_ptr);
26981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26983         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
26984         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
26985         return tag_ptr(ret_conv, true);
26986 }
26987
26988 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
26989         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
26990         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
26991         return ret_conv;
26992 }
26993
26994 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
26995         if (!ptr_is_owned(_res)) return;
26996         void* _res_ptr = untag_ptr(_res);
26997         CHECK_ACCESS(_res_ptr);
26998         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
26999         FREE(untag_ptr(_res));
27000         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
27001 }
27002
27003 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
27004         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27005         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
27006         return tag_ptr(ret_conv, true);
27007 }
27008 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
27009         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
27010         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
27011         return ret_conv;
27012 }
27013
27014 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
27015         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
27016         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27017         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
27018         return tag_ptr(ret_conv, true);
27019 }
27020
27021 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_ok"))) TS_CResult_OnionPacketDecodeErrorZ_ok(uint64_t o) {
27022         LDKOnionPacket o_conv;
27023         o_conv.inner = untag_ptr(o);
27024         o_conv.is_owned = ptr_is_owned(o);
27025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27026         o_conv = OnionPacket_clone(&o_conv);
27027         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27028         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
27029         return tag_ptr(ret_conv, true);
27030 }
27031
27032 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_err"))) TS_CResult_OnionPacketDecodeErrorZ_err(uint64_t e) {
27033         void* e_ptr = untag_ptr(e);
27034         CHECK_ACCESS(e_ptr);
27035         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27036         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27037         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27038         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
27039         return tag_ptr(ret_conv, true);
27040 }
27041
27042 jboolean  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_is_ok"))) TS_CResult_OnionPacketDecodeErrorZ_is_ok(uint64_t o) {
27043         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
27044         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
27045         return ret_conv;
27046 }
27047
27048 void  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_free"))) TS_CResult_OnionPacketDecodeErrorZ_free(uint64_t _res) {
27049         if (!ptr_is_owned(_res)) return;
27050         void* _res_ptr = untag_ptr(_res);
27051         CHECK_ACCESS(_res_ptr);
27052         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
27053         FREE(untag_ptr(_res));
27054         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
27055 }
27056
27057 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
27058         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27059         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
27060         return tag_ptr(ret_conv, true);
27061 }
27062 int64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone_ptr"))) TS_CResult_OnionPacketDecodeErrorZ_clone_ptr(uint64_t arg) {
27063         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
27064         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
27065         return ret_conv;
27066 }
27067
27068 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone"))) TS_CResult_OnionPacketDecodeErrorZ_clone(uint64_t orig) {
27069         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
27070         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27071         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
27072         return tag_ptr(ret_conv, true);
27073 }
27074
27075 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
27076         LDKUpdateAddHTLC o_conv;
27077         o_conv.inner = untag_ptr(o);
27078         o_conv.is_owned = ptr_is_owned(o);
27079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27080         o_conv = UpdateAddHTLC_clone(&o_conv);
27081         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27082         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
27083         return tag_ptr(ret_conv, true);
27084 }
27085
27086 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
27087         void* e_ptr = untag_ptr(e);
27088         CHECK_ACCESS(e_ptr);
27089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27091         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27092         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
27093         return tag_ptr(ret_conv, true);
27094 }
27095
27096 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
27097         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
27098         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
27099         return ret_conv;
27100 }
27101
27102 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
27103         if (!ptr_is_owned(_res)) return;
27104         void* _res_ptr = untag_ptr(_res);
27105         CHECK_ACCESS(_res_ptr);
27106         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
27107         FREE(untag_ptr(_res));
27108         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
27109 }
27110
27111 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
27112         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27113         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
27114         return tag_ptr(ret_conv, true);
27115 }
27116 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
27117         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
27118         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
27119         return ret_conv;
27120 }
27121
27122 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
27123         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
27124         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27125         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
27126         return tag_ptr(ret_conv, true);
27127 }
27128
27129 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
27130         LDKOnionMessage o_conv;
27131         o_conv.inner = untag_ptr(o);
27132         o_conv.is_owned = ptr_is_owned(o);
27133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27134         o_conv = OnionMessage_clone(&o_conv);
27135         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27136         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
27137         return tag_ptr(ret_conv, true);
27138 }
27139
27140 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
27141         void* e_ptr = untag_ptr(e);
27142         CHECK_ACCESS(e_ptr);
27143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27145         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27146         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
27147         return tag_ptr(ret_conv, true);
27148 }
27149
27150 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
27151         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
27152         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
27153         return ret_conv;
27154 }
27155
27156 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
27157         if (!ptr_is_owned(_res)) return;
27158         void* _res_ptr = untag_ptr(_res);
27159         CHECK_ACCESS(_res_ptr);
27160         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
27161         FREE(untag_ptr(_res));
27162         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
27163 }
27164
27165 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
27166         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27167         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
27168         return tag_ptr(ret_conv, true);
27169 }
27170 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
27171         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
27172         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
27173         return ret_conv;
27174 }
27175
27176 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
27177         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
27178         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27179         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
27180         return tag_ptr(ret_conv, true);
27181 }
27182
27183 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_ok(uint64_t o) {
27184         LDKFinalOnionHopData o_conv;
27185         o_conv.inner = untag_ptr(o);
27186         o_conv.is_owned = ptr_is_owned(o);
27187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27188         o_conv = FinalOnionHopData_clone(&o_conv);
27189         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27190         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
27191         return tag_ptr(ret_conv, true);
27192 }
27193
27194 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_err(uint64_t e) {
27195         void* e_ptr = untag_ptr(e);
27196         CHECK_ACCESS(e_ptr);
27197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27199         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27200         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
27201         return tag_ptr(ret_conv, true);
27202 }
27203
27204 jboolean  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(uint64_t o) {
27205         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
27206         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
27207         return ret_conv;
27208 }
27209
27210 void  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_free"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_free(uint64_t _res) {
27211         if (!ptr_is_owned(_res)) return;
27212         void* _res_ptr = untag_ptr(_res);
27213         CHECK_ACCESS(_res_ptr);
27214         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
27215         FREE(untag_ptr(_res));
27216         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
27217 }
27218
27219 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
27220         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27221         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
27222         return tag_ptr(ret_conv, true);
27223 }
27224 int64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(uint64_t arg) {
27225         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
27226         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
27227         return ret_conv;
27228 }
27229
27230 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone(uint64_t orig) {
27231         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
27232         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27233         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
27234         return tag_ptr(ret_conv, true);
27235 }
27236
27237 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
27238         LDKPing o_conv;
27239         o_conv.inner = untag_ptr(o);
27240         o_conv.is_owned = ptr_is_owned(o);
27241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27242         o_conv = Ping_clone(&o_conv);
27243         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27244         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
27245         return tag_ptr(ret_conv, true);
27246 }
27247
27248 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
27249         void* e_ptr = untag_ptr(e);
27250         CHECK_ACCESS(e_ptr);
27251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27253         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27254         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
27255         return tag_ptr(ret_conv, true);
27256 }
27257
27258 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
27259         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
27260         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
27261         return ret_conv;
27262 }
27263
27264 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
27265         if (!ptr_is_owned(_res)) return;
27266         void* _res_ptr = untag_ptr(_res);
27267         CHECK_ACCESS(_res_ptr);
27268         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
27269         FREE(untag_ptr(_res));
27270         CResult_PingDecodeErrorZ_free(_res_conv);
27271 }
27272
27273 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
27274         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27275         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
27276         return tag_ptr(ret_conv, true);
27277 }
27278 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
27279         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
27280         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
27281         return ret_conv;
27282 }
27283
27284 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
27285         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
27286         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27287         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
27288         return tag_ptr(ret_conv, true);
27289 }
27290
27291 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
27292         LDKPong o_conv;
27293         o_conv.inner = untag_ptr(o);
27294         o_conv.is_owned = ptr_is_owned(o);
27295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27296         o_conv = Pong_clone(&o_conv);
27297         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27298         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
27299         return tag_ptr(ret_conv, true);
27300 }
27301
27302 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
27303         void* e_ptr = untag_ptr(e);
27304         CHECK_ACCESS(e_ptr);
27305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27307         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27308         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
27309         return tag_ptr(ret_conv, true);
27310 }
27311
27312 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
27313         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
27314         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
27315         return ret_conv;
27316 }
27317
27318 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
27319         if (!ptr_is_owned(_res)) return;
27320         void* _res_ptr = untag_ptr(_res);
27321         CHECK_ACCESS(_res_ptr);
27322         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
27323         FREE(untag_ptr(_res));
27324         CResult_PongDecodeErrorZ_free(_res_conv);
27325 }
27326
27327 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
27328         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27329         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
27330         return tag_ptr(ret_conv, true);
27331 }
27332 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
27333         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
27334         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
27335         return ret_conv;
27336 }
27337
27338 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
27339         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
27340         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27341         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
27342         return tag_ptr(ret_conv, true);
27343 }
27344
27345 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
27346         LDKUnsignedChannelAnnouncement o_conv;
27347         o_conv.inner = untag_ptr(o);
27348         o_conv.is_owned = ptr_is_owned(o);
27349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27350         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
27351         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27352         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
27353         return tag_ptr(ret_conv, true);
27354 }
27355
27356 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
27357         void* e_ptr = untag_ptr(e);
27358         CHECK_ACCESS(e_ptr);
27359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27361         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27362         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
27363         return tag_ptr(ret_conv, true);
27364 }
27365
27366 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27367         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27368         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27369         return ret_conv;
27370 }
27371
27372 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
27373         if (!ptr_is_owned(_res)) return;
27374         void* _res_ptr = untag_ptr(_res);
27375         CHECK_ACCESS(_res_ptr);
27376         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27377         FREE(untag_ptr(_res));
27378         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
27379 }
27380
27381 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27382         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27383         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
27384         return tag_ptr(ret_conv, true);
27385 }
27386 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27387         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27388         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27389         return ret_conv;
27390 }
27391
27392 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27393         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27394         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27395         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27396         return tag_ptr(ret_conv, true);
27397 }
27398
27399 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
27400         LDKChannelAnnouncement o_conv;
27401         o_conv.inner = untag_ptr(o);
27402         o_conv.is_owned = ptr_is_owned(o);
27403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27404         o_conv = ChannelAnnouncement_clone(&o_conv);
27405         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27406         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
27407         return tag_ptr(ret_conv, true);
27408 }
27409
27410 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_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_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27416         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
27417         return tag_ptr(ret_conv, true);
27418 }
27419
27420 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27421         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27422         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27423         return ret_conv;
27424 }
27425
27426 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_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_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27431         FREE(untag_ptr(_res));
27432         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
27433 }
27434
27435 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27436         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27437         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
27438         return tag_ptr(ret_conv, true);
27439 }
27440 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27441         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27442         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27443         return ret_conv;
27444 }
27445
27446 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27447         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27448         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27449         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27450         return tag_ptr(ret_conv, true);
27451 }
27452
27453 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
27454         LDKUnsignedChannelUpdate o_conv;
27455         o_conv.inner = untag_ptr(o);
27456         o_conv.is_owned = ptr_is_owned(o);
27457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27458         o_conv = UnsignedChannelUpdate_clone(&o_conv);
27459         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27460         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
27461         return tag_ptr(ret_conv, true);
27462 }
27463
27464 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
27465         void* e_ptr = untag_ptr(e);
27466         CHECK_ACCESS(e_ptr);
27467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27469         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27470         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
27471         return tag_ptr(ret_conv, true);
27472 }
27473
27474 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
27475         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
27476         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
27477         return ret_conv;
27478 }
27479
27480 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
27481         if (!ptr_is_owned(_res)) return;
27482         void* _res_ptr = untag_ptr(_res);
27483         CHECK_ACCESS(_res_ptr);
27484         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
27485         FREE(untag_ptr(_res));
27486         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
27487 }
27488
27489 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27490         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27491         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
27492         return tag_ptr(ret_conv, true);
27493 }
27494 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
27495         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27496         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27497         return ret_conv;
27498 }
27499
27500 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
27501         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27502         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27503         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
27504         return tag_ptr(ret_conv, true);
27505 }
27506
27507 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
27508         LDKChannelUpdate o_conv;
27509         o_conv.inner = untag_ptr(o);
27510         o_conv.is_owned = ptr_is_owned(o);
27511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27512         o_conv = ChannelUpdate_clone(&o_conv);
27513         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27514         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
27515         return tag_ptr(ret_conv, true);
27516 }
27517
27518 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
27519         void* e_ptr = untag_ptr(e);
27520         CHECK_ACCESS(e_ptr);
27521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27523         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27524         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
27525         return tag_ptr(ret_conv, true);
27526 }
27527
27528 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
27529         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
27530         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
27531         return ret_conv;
27532 }
27533
27534 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
27535         if (!ptr_is_owned(_res)) return;
27536         void* _res_ptr = untag_ptr(_res);
27537         CHECK_ACCESS(_res_ptr);
27538         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
27539         FREE(untag_ptr(_res));
27540         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
27541 }
27542
27543 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27544         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27545         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
27546         return tag_ptr(ret_conv, true);
27547 }
27548 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
27549         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27550         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27551         return ret_conv;
27552 }
27553
27554 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
27555         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27556         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27557         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
27558         return tag_ptr(ret_conv, true);
27559 }
27560
27561 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
27562         LDKErrorMessage o_conv;
27563         o_conv.inner = untag_ptr(o);
27564         o_conv.is_owned = ptr_is_owned(o);
27565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27566         o_conv = ErrorMessage_clone(&o_conv);
27567         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27568         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
27569         return tag_ptr(ret_conv, true);
27570 }
27571
27572 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
27573         void* e_ptr = untag_ptr(e);
27574         CHECK_ACCESS(e_ptr);
27575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27577         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27578         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
27579         return tag_ptr(ret_conv, true);
27580 }
27581
27582 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
27583         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
27584         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
27585         return ret_conv;
27586 }
27587
27588 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
27589         if (!ptr_is_owned(_res)) return;
27590         void* _res_ptr = untag_ptr(_res);
27591         CHECK_ACCESS(_res_ptr);
27592         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
27593         FREE(untag_ptr(_res));
27594         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
27595 }
27596
27597 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
27598         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27599         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
27600         return tag_ptr(ret_conv, true);
27601 }
27602 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
27603         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
27604         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
27605         return ret_conv;
27606 }
27607
27608 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
27609         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
27610         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27611         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
27612         return tag_ptr(ret_conv, true);
27613 }
27614
27615 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
27616         LDKWarningMessage o_conv;
27617         o_conv.inner = untag_ptr(o);
27618         o_conv.is_owned = ptr_is_owned(o);
27619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27620         o_conv = WarningMessage_clone(&o_conv);
27621         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27622         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
27623         return tag_ptr(ret_conv, true);
27624 }
27625
27626 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
27627         void* e_ptr = untag_ptr(e);
27628         CHECK_ACCESS(e_ptr);
27629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27631         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27632         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
27633         return tag_ptr(ret_conv, true);
27634 }
27635
27636 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
27637         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
27638         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
27639         return ret_conv;
27640 }
27641
27642 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
27643         if (!ptr_is_owned(_res)) return;
27644         void* _res_ptr = untag_ptr(_res);
27645         CHECK_ACCESS(_res_ptr);
27646         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
27647         FREE(untag_ptr(_res));
27648         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
27649 }
27650
27651 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
27652         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27653         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
27654         return tag_ptr(ret_conv, true);
27655 }
27656 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
27657         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
27658         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
27659         return ret_conv;
27660 }
27661
27662 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
27663         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
27664         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27665         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
27666         return tag_ptr(ret_conv, true);
27667 }
27668
27669 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
27670         LDKUnsignedNodeAnnouncement o_conv;
27671         o_conv.inner = untag_ptr(o);
27672         o_conv.is_owned = ptr_is_owned(o);
27673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27674         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
27675         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27676         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
27677         return tag_ptr(ret_conv, true);
27678 }
27679
27680 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
27681         void* e_ptr = untag_ptr(e);
27682         CHECK_ACCESS(e_ptr);
27683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27685         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27686         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
27687         return tag_ptr(ret_conv, true);
27688 }
27689
27690 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27691         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
27692         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
27693         return ret_conv;
27694 }
27695
27696 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
27697         if (!ptr_is_owned(_res)) return;
27698         void* _res_ptr = untag_ptr(_res);
27699         CHECK_ACCESS(_res_ptr);
27700         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
27701         FREE(untag_ptr(_res));
27702         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
27703 }
27704
27705 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27706         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27707         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
27708         return tag_ptr(ret_conv, true);
27709 }
27710 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27711         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
27712         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27713         return ret_conv;
27714 }
27715
27716 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27717         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
27718         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27719         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
27720         return tag_ptr(ret_conv, true);
27721 }
27722
27723 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
27724         LDKNodeAnnouncement o_conv;
27725         o_conv.inner = untag_ptr(o);
27726         o_conv.is_owned = ptr_is_owned(o);
27727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27728         o_conv = NodeAnnouncement_clone(&o_conv);
27729         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27730         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
27731         return tag_ptr(ret_conv, true);
27732 }
27733
27734 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
27735         void* e_ptr = untag_ptr(e);
27736         CHECK_ACCESS(e_ptr);
27737         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27738         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27739         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27740         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
27741         return tag_ptr(ret_conv, true);
27742 }
27743
27744 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27745         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
27746         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
27747         return ret_conv;
27748 }
27749
27750 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
27751         if (!ptr_is_owned(_res)) return;
27752         void* _res_ptr = untag_ptr(_res);
27753         CHECK_ACCESS(_res_ptr);
27754         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
27755         FREE(untag_ptr(_res));
27756         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
27757 }
27758
27759 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27760         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27761         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
27762         return tag_ptr(ret_conv, true);
27763 }
27764 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27765         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
27766         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27767         return ret_conv;
27768 }
27769
27770 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27771         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
27772         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27773         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
27774         return tag_ptr(ret_conv, true);
27775 }
27776
27777 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
27778         LDKQueryShortChannelIds o_conv;
27779         o_conv.inner = untag_ptr(o);
27780         o_conv.is_owned = ptr_is_owned(o);
27781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27782         o_conv = QueryShortChannelIds_clone(&o_conv);
27783         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27784         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
27785         return tag_ptr(ret_conv, true);
27786 }
27787
27788 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
27789         void* e_ptr = untag_ptr(e);
27790         CHECK_ACCESS(e_ptr);
27791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27793         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27794         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
27795         return tag_ptr(ret_conv, true);
27796 }
27797
27798 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
27799         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
27800         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
27801         return ret_conv;
27802 }
27803
27804 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
27805         if (!ptr_is_owned(_res)) return;
27806         void* _res_ptr = untag_ptr(_res);
27807         CHECK_ACCESS(_res_ptr);
27808         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
27809         FREE(untag_ptr(_res));
27810         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
27811 }
27812
27813 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
27814         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27815         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
27816         return tag_ptr(ret_conv, true);
27817 }
27818 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
27819         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
27820         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
27821         return ret_conv;
27822 }
27823
27824 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
27825         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
27826         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27827         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
27828         return tag_ptr(ret_conv, true);
27829 }
27830
27831 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
27832         LDKReplyShortChannelIdsEnd o_conv;
27833         o_conv.inner = untag_ptr(o);
27834         o_conv.is_owned = ptr_is_owned(o);
27835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27836         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
27837         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27838         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
27839         return tag_ptr(ret_conv, true);
27840 }
27841
27842 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
27843         void* e_ptr = untag_ptr(e);
27844         CHECK_ACCESS(e_ptr);
27845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27847         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27848         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
27849         return tag_ptr(ret_conv, true);
27850 }
27851
27852 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
27853         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
27854         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
27855         return ret_conv;
27856 }
27857
27858 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
27859         if (!ptr_is_owned(_res)) return;
27860         void* _res_ptr = untag_ptr(_res);
27861         CHECK_ACCESS(_res_ptr);
27862         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
27863         FREE(untag_ptr(_res));
27864         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
27865 }
27866
27867 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
27868         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27869         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
27870         return tag_ptr(ret_conv, true);
27871 }
27872 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
27873         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
27874         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
27875         return ret_conv;
27876 }
27877
27878 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
27879         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
27880         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27881         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
27882         return tag_ptr(ret_conv, true);
27883 }
27884
27885 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
27886         LDKQueryChannelRange o_conv;
27887         o_conv.inner = untag_ptr(o);
27888         o_conv.is_owned = ptr_is_owned(o);
27889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27890         o_conv = QueryChannelRange_clone(&o_conv);
27891         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27892         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
27893         return tag_ptr(ret_conv, true);
27894 }
27895
27896 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
27897         void* e_ptr = untag_ptr(e);
27898         CHECK_ACCESS(e_ptr);
27899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27901         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27902         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
27903         return tag_ptr(ret_conv, true);
27904 }
27905
27906 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
27907         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
27908         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
27909         return ret_conv;
27910 }
27911
27912 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
27913         if (!ptr_is_owned(_res)) return;
27914         void* _res_ptr = untag_ptr(_res);
27915         CHECK_ACCESS(_res_ptr);
27916         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
27917         FREE(untag_ptr(_res));
27918         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
27919 }
27920
27921 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
27922         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27923         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
27924         return tag_ptr(ret_conv, true);
27925 }
27926 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
27927         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
27928         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
27929         return ret_conv;
27930 }
27931
27932 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
27933         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
27934         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27935         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
27936         return tag_ptr(ret_conv, true);
27937 }
27938
27939 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
27940         LDKReplyChannelRange o_conv;
27941         o_conv.inner = untag_ptr(o);
27942         o_conv.is_owned = ptr_is_owned(o);
27943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27944         o_conv = ReplyChannelRange_clone(&o_conv);
27945         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27946         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
27947         return tag_ptr(ret_conv, true);
27948 }
27949
27950 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
27951         void* e_ptr = untag_ptr(e);
27952         CHECK_ACCESS(e_ptr);
27953         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27954         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27955         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27956         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
27957         return tag_ptr(ret_conv, true);
27958 }
27959
27960 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
27961         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
27962         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
27963         return ret_conv;
27964 }
27965
27966 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
27967         if (!ptr_is_owned(_res)) return;
27968         void* _res_ptr = untag_ptr(_res);
27969         CHECK_ACCESS(_res_ptr);
27970         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
27971         FREE(untag_ptr(_res));
27972         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
27973 }
27974
27975 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
27976         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27977         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
27978         return tag_ptr(ret_conv, true);
27979 }
27980 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
27981         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
27982         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
27983         return ret_conv;
27984 }
27985
27986 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
27987         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
27988         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27989         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
27990         return tag_ptr(ret_conv, true);
27991 }
27992
27993 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
27994         LDKGossipTimestampFilter o_conv;
27995         o_conv.inner = untag_ptr(o);
27996         o_conv.is_owned = ptr_is_owned(o);
27997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27998         o_conv = GossipTimestampFilter_clone(&o_conv);
27999         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28000         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
28001         return tag_ptr(ret_conv, true);
28002 }
28003
28004 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
28005         void* e_ptr = untag_ptr(e);
28006         CHECK_ACCESS(e_ptr);
28007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28009         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28010         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
28011         return tag_ptr(ret_conv, true);
28012 }
28013
28014 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
28015         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
28016         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
28017         return ret_conv;
28018 }
28019
28020 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
28021         if (!ptr_is_owned(_res)) return;
28022         void* _res_ptr = untag_ptr(_res);
28023         CHECK_ACCESS(_res_ptr);
28024         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
28025         FREE(untag_ptr(_res));
28026         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
28027 }
28028
28029 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
28030         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28031         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
28032         return tag_ptr(ret_conv, true);
28033 }
28034 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
28035         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
28036         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
28037         return ret_conv;
28038 }
28039
28040 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
28041         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
28042         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28043         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
28044         return tag_ptr(ret_conv, true);
28045 }
28046
28047 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
28048         LDKCVec_PhantomRouteHintsZ _res_constr;
28049         _res_constr.datalen = _res->arr_len;
28050         if (_res_constr.datalen > 0)
28051                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
28052         else
28053                 _res_constr.data = NULL;
28054         uint64_t* _res_vals = _res->elems;
28055         for (size_t t = 0; t < _res_constr.datalen; t++) {
28056                 uint64_t _res_conv_19 = _res_vals[t];
28057                 LDKPhantomRouteHints _res_conv_19_conv;
28058                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28059                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28060                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28061                 _res_constr.data[t] = _res_conv_19_conv;
28062         }
28063         FREE(_res);
28064         CVec_PhantomRouteHintsZ_free(_res_constr);
28065 }
28066
28067 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
28068         LDKBolt11Invoice o_conv;
28069         o_conv.inner = untag_ptr(o);
28070         o_conv.is_owned = ptr_is_owned(o);
28071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28072         o_conv = Bolt11Invoice_clone(&o_conv);
28073         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28074         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
28075         return tag_ptr(ret_conv, true);
28076 }
28077
28078 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
28079         void* e_ptr = untag_ptr(e);
28080         CHECK_ACCESS(e_ptr);
28081         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
28082         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
28083         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28084         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
28085         return tag_ptr(ret_conv, true);
28086 }
28087
28088 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
28089         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
28090         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
28091         return ret_conv;
28092 }
28093
28094 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
28095         if (!ptr_is_owned(_res)) return;
28096         void* _res_ptr = untag_ptr(_res);
28097         CHECK_ACCESS(_res_ptr);
28098         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
28099         FREE(untag_ptr(_res));
28100         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
28101 }
28102
28103 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
28104         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28105         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
28106         return tag_ptr(ret_conv, true);
28107 }
28108 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
28109         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
28110         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
28111         return ret_conv;
28112 }
28113
28114 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
28115         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
28116         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28117         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
28118         return tag_ptr(ret_conv, true);
28119 }
28120
28121 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
28122         void* o_ptr = untag_ptr(o);
28123         CHECK_ACCESS(o_ptr);
28124         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
28125         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
28126         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28127         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
28128         return tag_ptr(ret_conv, true);
28129 }
28130
28131 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
28132         void* e_ptr = untag_ptr(e);
28133         CHECK_ACCESS(e_ptr);
28134         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28135         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28136         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28137         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
28138         return tag_ptr(ret_conv, true);
28139 }
28140
28141 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
28142         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
28143         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
28144         return ret_conv;
28145 }
28146
28147 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
28148         if (!ptr_is_owned(_res)) return;
28149         void* _res_ptr = untag_ptr(_res);
28150         CHECK_ACCESS(_res_ptr);
28151         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
28152         FREE(untag_ptr(_res));
28153         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
28154 }
28155
28156 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
28157         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28158         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
28159         return tag_ptr(ret_conv, true);
28160 }
28161 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
28162         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
28163         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
28164         return ret_conv;
28165 }
28166
28167 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
28168         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
28169         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28170         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
28171         return tag_ptr(ret_conv, true);
28172 }
28173
28174 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
28175         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
28176         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28177         *ret_copy = COption_HTLCClaimZ_some(o_conv);
28178         uint64_t ret_ref = tag_ptr(ret_copy, true);
28179         return ret_ref;
28180 }
28181
28182 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
28183         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28184         *ret_copy = COption_HTLCClaimZ_none();
28185         uint64_t ret_ref = tag_ptr(ret_copy, true);
28186         return ret_ref;
28187 }
28188
28189 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
28190         if (!ptr_is_owned(_res)) return;
28191         void* _res_ptr = untag_ptr(_res);
28192         CHECK_ACCESS(_res_ptr);
28193         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
28194         FREE(untag_ptr(_res));
28195         COption_HTLCClaimZ_free(_res_conv);
28196 }
28197
28198 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
28199         LDKCounterpartyCommitmentSecrets o_conv;
28200         o_conv.inner = untag_ptr(o);
28201         o_conv.is_owned = ptr_is_owned(o);
28202         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28203         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
28204         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28205         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
28206         return tag_ptr(ret_conv, true);
28207 }
28208
28209 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
28210         void* e_ptr = untag_ptr(e);
28211         CHECK_ACCESS(e_ptr);
28212         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28213         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28214         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28215         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
28216         return tag_ptr(ret_conv, true);
28217 }
28218
28219 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
28220         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
28221         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
28222         return ret_conv;
28223 }
28224
28225 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
28226         if (!ptr_is_owned(_res)) return;
28227         void* _res_ptr = untag_ptr(_res);
28228         CHECK_ACCESS(_res_ptr);
28229         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
28230         FREE(untag_ptr(_res));
28231         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
28232 }
28233
28234 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
28235         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28236         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
28237         return tag_ptr(ret_conv, true);
28238 }
28239 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
28240         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
28241         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
28242         return ret_conv;
28243 }
28244
28245 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
28246         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
28247         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28248         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
28249         return tag_ptr(ret_conv, true);
28250 }
28251
28252 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
28253         LDKTxCreationKeys o_conv;
28254         o_conv.inner = untag_ptr(o);
28255         o_conv.is_owned = ptr_is_owned(o);
28256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28257         o_conv = TxCreationKeys_clone(&o_conv);
28258         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28259         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
28260         return tag_ptr(ret_conv, true);
28261 }
28262
28263 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
28264         void* e_ptr = untag_ptr(e);
28265         CHECK_ACCESS(e_ptr);
28266         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28267         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28268         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28269         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
28270         return tag_ptr(ret_conv, true);
28271 }
28272
28273 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
28274         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
28275         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
28276         return ret_conv;
28277 }
28278
28279 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
28280         if (!ptr_is_owned(_res)) return;
28281         void* _res_ptr = untag_ptr(_res);
28282         CHECK_ACCESS(_res_ptr);
28283         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
28284         FREE(untag_ptr(_res));
28285         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
28286 }
28287
28288 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
28289         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28290         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
28291         return tag_ptr(ret_conv, true);
28292 }
28293 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
28294         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
28295         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
28296         return ret_conv;
28297 }
28298
28299 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
28300         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
28301         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28302         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
28303         return tag_ptr(ret_conv, true);
28304 }
28305
28306 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
28307         LDKChannelPublicKeys o_conv;
28308         o_conv.inner = untag_ptr(o);
28309         o_conv.is_owned = ptr_is_owned(o);
28310         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28311         o_conv = ChannelPublicKeys_clone(&o_conv);
28312         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28313         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
28314         return tag_ptr(ret_conv, true);
28315 }
28316
28317 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
28318         void* e_ptr = untag_ptr(e);
28319         CHECK_ACCESS(e_ptr);
28320         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28321         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28322         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28323         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
28324         return tag_ptr(ret_conv, true);
28325 }
28326
28327 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
28328         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
28329         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
28330         return ret_conv;
28331 }
28332
28333 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
28334         if (!ptr_is_owned(_res)) return;
28335         void* _res_ptr = untag_ptr(_res);
28336         CHECK_ACCESS(_res_ptr);
28337         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
28338         FREE(untag_ptr(_res));
28339         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
28340 }
28341
28342 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
28343         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28344         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
28345         return tag_ptr(ret_conv, true);
28346 }
28347 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
28348         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
28349         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
28350         return ret_conv;
28351 }
28352
28353 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
28354         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
28355         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28356         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
28357         return tag_ptr(ret_conv, true);
28358 }
28359
28360 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
28361         LDKHTLCOutputInCommitment o_conv;
28362         o_conv.inner = untag_ptr(o);
28363         o_conv.is_owned = ptr_is_owned(o);
28364         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28365         o_conv = HTLCOutputInCommitment_clone(&o_conv);
28366         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28367         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
28368         return tag_ptr(ret_conv, true);
28369 }
28370
28371 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
28372         void* e_ptr = untag_ptr(e);
28373         CHECK_ACCESS(e_ptr);
28374         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28375         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28376         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28377         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
28378         return tag_ptr(ret_conv, true);
28379 }
28380
28381 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
28382         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
28383         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
28384         return ret_conv;
28385 }
28386
28387 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
28388         if (!ptr_is_owned(_res)) return;
28389         void* _res_ptr = untag_ptr(_res);
28390         CHECK_ACCESS(_res_ptr);
28391         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
28392         FREE(untag_ptr(_res));
28393         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
28394 }
28395
28396 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
28397         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28398         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
28399         return tag_ptr(ret_conv, true);
28400 }
28401 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
28402         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
28403         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
28404         return ret_conv;
28405 }
28406
28407 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
28408         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
28409         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28410         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
28411         return tag_ptr(ret_conv, true);
28412 }
28413
28414 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
28415         LDKCounterpartyChannelTransactionParameters o_conv;
28416         o_conv.inner = untag_ptr(o);
28417         o_conv.is_owned = ptr_is_owned(o);
28418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28419         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
28420         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28421         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28422         return tag_ptr(ret_conv, true);
28423 }
28424
28425 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
28426         void* e_ptr = untag_ptr(e);
28427         CHECK_ACCESS(e_ptr);
28428         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28429         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28430         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28431         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
28432         return tag_ptr(ret_conv, true);
28433 }
28434
28435 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
28436         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28437         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28438         return ret_conv;
28439 }
28440
28441 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
28442         if (!ptr_is_owned(_res)) return;
28443         void* _res_ptr = untag_ptr(_res);
28444         CHECK_ACCESS(_res_ptr);
28445         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28446         FREE(untag_ptr(_res));
28447         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28448 }
28449
28450 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28451         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28452         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
28453         return tag_ptr(ret_conv, true);
28454 }
28455 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
28456         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28457         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28458         return ret_conv;
28459 }
28460
28461 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
28462         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28463         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28464         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28465         return tag_ptr(ret_conv, true);
28466 }
28467
28468 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
28469         LDKChannelTransactionParameters o_conv;
28470         o_conv.inner = untag_ptr(o);
28471         o_conv.is_owned = ptr_is_owned(o);
28472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28473         o_conv = ChannelTransactionParameters_clone(&o_conv);
28474         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28475         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28476         return tag_ptr(ret_conv, true);
28477 }
28478
28479 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
28480         void* e_ptr = untag_ptr(e);
28481         CHECK_ACCESS(e_ptr);
28482         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28483         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28484         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28485         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
28486         return tag_ptr(ret_conv, true);
28487 }
28488
28489 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
28490         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28491         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28492         return ret_conv;
28493 }
28494
28495 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
28496         if (!ptr_is_owned(_res)) return;
28497         void* _res_ptr = untag_ptr(_res);
28498         CHECK_ACCESS(_res_ptr);
28499         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28500         FREE(untag_ptr(_res));
28501         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28502 }
28503
28504 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28505         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28506         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
28507         return tag_ptr(ret_conv, true);
28508 }
28509 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
28510         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28511         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28512         return ret_conv;
28513 }
28514
28515 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
28516         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28517         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28518         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28519         return tag_ptr(ret_conv, true);
28520 }
28521
28522 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
28523         LDKHolderCommitmentTransaction o_conv;
28524         o_conv.inner = untag_ptr(o);
28525         o_conv.is_owned = ptr_is_owned(o);
28526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28527         o_conv = HolderCommitmentTransaction_clone(&o_conv);
28528         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28529         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
28530         return tag_ptr(ret_conv, true);
28531 }
28532
28533 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
28534         void* e_ptr = untag_ptr(e);
28535         CHECK_ACCESS(e_ptr);
28536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28538         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28539         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
28540         return tag_ptr(ret_conv, true);
28541 }
28542
28543 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
28544         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28545         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28546         return ret_conv;
28547 }
28548
28549 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
28550         if (!ptr_is_owned(_res)) return;
28551         void* _res_ptr = untag_ptr(_res);
28552         CHECK_ACCESS(_res_ptr);
28553         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28554         FREE(untag_ptr(_res));
28555         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
28556 }
28557
28558 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28559         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28560         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
28561         return tag_ptr(ret_conv, true);
28562 }
28563 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
28564         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28565         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28566         return ret_conv;
28567 }
28568
28569 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
28570         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28571         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28572         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28573         return tag_ptr(ret_conv, true);
28574 }
28575
28576 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
28577         LDKBuiltCommitmentTransaction o_conv;
28578         o_conv.inner = untag_ptr(o);
28579         o_conv.is_owned = ptr_is_owned(o);
28580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28581         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
28582         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28583         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
28584         return tag_ptr(ret_conv, true);
28585 }
28586
28587 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
28588         void* e_ptr = untag_ptr(e);
28589         CHECK_ACCESS(e_ptr);
28590         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28591         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28592         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28593         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
28594         return tag_ptr(ret_conv, true);
28595 }
28596
28597 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
28598         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28599         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28600         return ret_conv;
28601 }
28602
28603 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
28604         if (!ptr_is_owned(_res)) return;
28605         void* _res_ptr = untag_ptr(_res);
28606         CHECK_ACCESS(_res_ptr);
28607         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28608         FREE(untag_ptr(_res));
28609         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
28610 }
28611
28612 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28613         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28614         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
28615         return tag_ptr(ret_conv, true);
28616 }
28617 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
28618         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28619         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28620         return ret_conv;
28621 }
28622
28623 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
28624         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28625         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28626         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28627         return tag_ptr(ret_conv, true);
28628 }
28629
28630 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
28631         LDKTrustedClosingTransaction o_conv;
28632         o_conv.inner = untag_ptr(o);
28633         o_conv.is_owned = ptr_is_owned(o);
28634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28635         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
28636         
28637         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28638         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
28639         return tag_ptr(ret_conv, true);
28640 }
28641
28642 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
28643         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28644         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
28645         return tag_ptr(ret_conv, true);
28646 }
28647
28648 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
28649         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
28650         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
28651         return ret_conv;
28652 }
28653
28654 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
28655         if (!ptr_is_owned(_res)) return;
28656         void* _res_ptr = untag_ptr(_res);
28657         CHECK_ACCESS(_res_ptr);
28658         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
28659         FREE(untag_ptr(_res));
28660         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
28661 }
28662
28663 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
28664         LDKCommitmentTransaction o_conv;
28665         o_conv.inner = untag_ptr(o);
28666         o_conv.is_owned = ptr_is_owned(o);
28667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28668         o_conv = CommitmentTransaction_clone(&o_conv);
28669         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28670         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
28671         return tag_ptr(ret_conv, true);
28672 }
28673
28674 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
28675         void* e_ptr = untag_ptr(e);
28676         CHECK_ACCESS(e_ptr);
28677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28679         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28680         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
28681         return tag_ptr(ret_conv, true);
28682 }
28683
28684 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
28685         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28686         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28687         return ret_conv;
28688 }
28689
28690 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
28691         if (!ptr_is_owned(_res)) return;
28692         void* _res_ptr = untag_ptr(_res);
28693         CHECK_ACCESS(_res_ptr);
28694         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
28695         FREE(untag_ptr(_res));
28696         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
28697 }
28698
28699 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28700         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28701         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
28702         return tag_ptr(ret_conv, true);
28703 }
28704 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
28705         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28706         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28707         return ret_conv;
28708 }
28709
28710 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
28711         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28712         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28713         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
28714         return tag_ptr(ret_conv, true);
28715 }
28716
28717 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
28718         LDKTrustedCommitmentTransaction o_conv;
28719         o_conv.inner = untag_ptr(o);
28720         o_conv.is_owned = ptr_is_owned(o);
28721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28722         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
28723         
28724         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
28725         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
28726         return tag_ptr(ret_conv, true);
28727 }
28728
28729 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
28730         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
28731         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
28732         return tag_ptr(ret_conv, true);
28733 }
28734
28735 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
28736         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
28737         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
28738         return ret_conv;
28739 }
28740
28741 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
28742         if (!ptr_is_owned(_res)) return;
28743         void* _res_ptr = untag_ptr(_res);
28744         CHECK_ACCESS(_res_ptr);
28745         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
28746         FREE(untag_ptr(_res));
28747         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
28748 }
28749
28750 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
28751         LDKCVec_ECDSASignatureZ o_constr;
28752         o_constr.datalen = o->arr_len;
28753         if (o_constr.datalen > 0)
28754                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
28755         else
28756                 o_constr.data = NULL;
28757         int8_tArray* o_vals = (void*) o->elems;
28758         for (size_t m = 0; m < o_constr.datalen; m++) {
28759                 int8_tArray o_conv_12 = o_vals[m];
28760                 LDKECDSASignature o_conv_12_ref;
28761                 CHECK(o_conv_12->arr_len == 64);
28762                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
28763                 o_constr.data[m] = o_conv_12_ref;
28764         }
28765         FREE(o);
28766         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28767         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
28768         return tag_ptr(ret_conv, true);
28769 }
28770
28771 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
28772         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28773         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
28774         return tag_ptr(ret_conv, true);
28775 }
28776
28777 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
28778         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
28779         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
28780         return ret_conv;
28781 }
28782
28783 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
28784         if (!ptr_is_owned(_res)) return;
28785         void* _res_ptr = untag_ptr(_res);
28786         CHECK_ACCESS(_res_ptr);
28787         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
28788         FREE(untag_ptr(_res));
28789         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
28790 }
28791
28792 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
28793         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28794         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
28795         return tag_ptr(ret_conv, true);
28796 }
28797 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
28798         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
28799         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
28800         return ret_conv;
28801 }
28802
28803 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
28804         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
28805         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28806         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
28807         return tag_ptr(ret_conv, true);
28808 }
28809
28810 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
28811         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28812         *ret_copy = COption_usizeZ_some(o);
28813         uint64_t ret_ref = tag_ptr(ret_copy, true);
28814         return ret_ref;
28815 }
28816
28817 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
28818         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28819         *ret_copy = COption_usizeZ_none();
28820         uint64_t ret_ref = tag_ptr(ret_copy, true);
28821         return ret_ref;
28822 }
28823
28824 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
28825         if (!ptr_is_owned(_res)) return;
28826         void* _res_ptr = untag_ptr(_res);
28827         CHECK_ACCESS(_res_ptr);
28828         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
28829         FREE(untag_ptr(_res));
28830         COption_usizeZ_free(_res_conv);
28831 }
28832
28833 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
28834         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28835         *ret_copy = COption_usizeZ_clone(arg);
28836         uint64_t ret_ref = tag_ptr(ret_copy, true);
28837         return ret_ref;
28838 }
28839 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
28840         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
28841         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
28842         return ret_conv;
28843 }
28844
28845 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
28846         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
28847         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28848         *ret_copy = COption_usizeZ_clone(orig_conv);
28849         uint64_t ret_ref = tag_ptr(ret_copy, true);
28850         return ret_ref;
28851 }
28852
28853 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
28854         LDKShutdownScript o_conv;
28855         o_conv.inner = untag_ptr(o);
28856         o_conv.is_owned = ptr_is_owned(o);
28857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28858         o_conv = ShutdownScript_clone(&o_conv);
28859         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28860         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
28861         return tag_ptr(ret_conv, true);
28862 }
28863
28864 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
28865         void* e_ptr = untag_ptr(e);
28866         CHECK_ACCESS(e_ptr);
28867         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28868         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28869         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28870         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
28871         return tag_ptr(ret_conv, true);
28872 }
28873
28874 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
28875         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
28876         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
28877         return ret_conv;
28878 }
28879
28880 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
28881         if (!ptr_is_owned(_res)) return;
28882         void* _res_ptr = untag_ptr(_res);
28883         CHECK_ACCESS(_res_ptr);
28884         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
28885         FREE(untag_ptr(_res));
28886         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
28887 }
28888
28889 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
28890         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28891         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
28892         return tag_ptr(ret_conv, true);
28893 }
28894 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
28895         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
28896         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
28897         return ret_conv;
28898 }
28899
28900 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
28901         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
28902         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28903         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
28904         return tag_ptr(ret_conv, true);
28905 }
28906
28907 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
28908         LDKShutdownScript o_conv;
28909         o_conv.inner = untag_ptr(o);
28910         o_conv.is_owned = ptr_is_owned(o);
28911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28912         o_conv = ShutdownScript_clone(&o_conv);
28913         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28914         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
28915         return tag_ptr(ret_conv, true);
28916 }
28917
28918 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
28919         LDKInvalidShutdownScript e_conv;
28920         e_conv.inner = untag_ptr(e);
28921         e_conv.is_owned = ptr_is_owned(e);
28922         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28923         e_conv = InvalidShutdownScript_clone(&e_conv);
28924         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28925         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
28926         return tag_ptr(ret_conv, true);
28927 }
28928
28929 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
28930         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
28931         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
28932         return ret_conv;
28933 }
28934
28935 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
28936         if (!ptr_is_owned(_res)) return;
28937         void* _res_ptr = untag_ptr(_res);
28938         CHECK_ACCESS(_res_ptr);
28939         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
28940         FREE(untag_ptr(_res));
28941         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
28942 }
28943
28944 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
28945         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28946         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
28947         return tag_ptr(ret_conv, true);
28948 }
28949 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
28950         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
28951         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
28952         return ret_conv;
28953 }
28954
28955 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
28956         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
28957         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28958         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
28959         return tag_ptr(ret_conv, true);
28960 }
28961
28962 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
28963         void* o_ptr = untag_ptr(o);
28964         CHECK_ACCESS(o_ptr);
28965         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
28966         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
28967         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
28968         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
28969         return tag_ptr(ret_conv, true);
28970 }
28971
28972 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
28973         void* e_ptr = untag_ptr(e);
28974         CHECK_ACCESS(e_ptr);
28975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28977         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
28978         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
28979         return tag_ptr(ret_conv, true);
28980 }
28981
28982 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
28983         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
28984         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
28985         return ret_conv;
28986 }
28987
28988 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
28989         if (!ptr_is_owned(_res)) return;
28990         void* _res_ptr = untag_ptr(_res);
28991         CHECK_ACCESS(_res_ptr);
28992         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
28993         FREE(untag_ptr(_res));
28994         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
28995 }
28996
28997 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
28998         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
28999         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
29000         return tag_ptr(ret_conv, true);
29001 }
29002 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
29003         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
29004         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
29005         return ret_conv;
29006 }
29007
29008 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
29009         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
29010         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29011         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
29012         return tag_ptr(ret_conv, true);
29013 }
29014
29015 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
29016         LDKClaimedHTLC o_conv;
29017         o_conv.inner = untag_ptr(o);
29018         o_conv.is_owned = ptr_is_owned(o);
29019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29020         o_conv = ClaimedHTLC_clone(&o_conv);
29021         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29022         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
29023         return tag_ptr(ret_conv, true);
29024 }
29025
29026 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
29027         void* e_ptr = untag_ptr(e);
29028         CHECK_ACCESS(e_ptr);
29029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29031         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29032         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
29033         return tag_ptr(ret_conv, true);
29034 }
29035
29036 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
29037         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
29038         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
29039         return ret_conv;
29040 }
29041
29042 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
29043         if (!ptr_is_owned(_res)) return;
29044         void* _res_ptr = untag_ptr(_res);
29045         CHECK_ACCESS(_res_ptr);
29046         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
29047         FREE(untag_ptr(_res));
29048         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
29049 }
29050
29051 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29052         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29053         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
29054         return tag_ptr(ret_conv, true);
29055 }
29056 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29057         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
29058         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29059         return ret_conv;
29060 }
29061
29062 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
29063         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
29064         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29065         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
29066         return tag_ptr(ret_conv, true);
29067 }
29068
29069 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
29070         void* o_ptr = untag_ptr(o);
29071         CHECK_ACCESS(o_ptr);
29072         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
29073         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
29074         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29075         *ret_copy = COption_PathFailureZ_some(o_conv);
29076         uint64_t ret_ref = tag_ptr(ret_copy, true);
29077         return ret_ref;
29078 }
29079
29080 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
29081         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29082         *ret_copy = COption_PathFailureZ_none();
29083         uint64_t ret_ref = tag_ptr(ret_copy, true);
29084         return ret_ref;
29085 }
29086
29087 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
29088         if (!ptr_is_owned(_res)) return;
29089         void* _res_ptr = untag_ptr(_res);
29090         CHECK_ACCESS(_res_ptr);
29091         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
29092         FREE(untag_ptr(_res));
29093         COption_PathFailureZ_free(_res_conv);
29094 }
29095
29096 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
29097         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29098         *ret_copy = COption_PathFailureZ_clone(arg);
29099         uint64_t ret_ref = tag_ptr(ret_copy, true);
29100         return ret_ref;
29101 }
29102 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
29103         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
29104         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
29105         return ret_conv;
29106 }
29107
29108 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
29109         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
29110         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29111         *ret_copy = COption_PathFailureZ_clone(orig_conv);
29112         uint64_t ret_ref = tag_ptr(ret_copy, true);
29113         return ret_ref;
29114 }
29115
29116 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
29117         void* o_ptr = untag_ptr(o);
29118         CHECK_ACCESS(o_ptr);
29119         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
29120         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
29121         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29122         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
29123         return tag_ptr(ret_conv, true);
29124 }
29125
29126 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
29127         void* e_ptr = untag_ptr(e);
29128         CHECK_ACCESS(e_ptr);
29129         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29130         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29131         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29132         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
29133         return tag_ptr(ret_conv, true);
29134 }
29135
29136 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
29137         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
29138         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
29139         return ret_conv;
29140 }
29141
29142 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
29143         if (!ptr_is_owned(_res)) return;
29144         void* _res_ptr = untag_ptr(_res);
29145         CHECK_ACCESS(_res_ptr);
29146         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
29147         FREE(untag_ptr(_res));
29148         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
29149 }
29150
29151 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
29152         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29153         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
29154         return tag_ptr(ret_conv, true);
29155 }
29156 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
29157         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
29158         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
29159         return ret_conv;
29160 }
29161
29162 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
29163         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
29164         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29165         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
29166         return tag_ptr(ret_conv, true);
29167 }
29168
29169 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
29170         void* o_ptr = untag_ptr(o);
29171         CHECK_ACCESS(o_ptr);
29172         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
29173         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
29174         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29175         *ret_copy = COption_ClosureReasonZ_some(o_conv);
29176         uint64_t ret_ref = tag_ptr(ret_copy, true);
29177         return ret_ref;
29178 }
29179
29180 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
29181         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29182         *ret_copy = COption_ClosureReasonZ_none();
29183         uint64_t ret_ref = tag_ptr(ret_copy, true);
29184         return ret_ref;
29185 }
29186
29187 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
29188         if (!ptr_is_owned(_res)) return;
29189         void* _res_ptr = untag_ptr(_res);
29190         CHECK_ACCESS(_res_ptr);
29191         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
29192         FREE(untag_ptr(_res));
29193         COption_ClosureReasonZ_free(_res_conv);
29194 }
29195
29196 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
29197         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29198         *ret_copy = COption_ClosureReasonZ_clone(arg);
29199         uint64_t ret_ref = tag_ptr(ret_copy, true);
29200         return ret_ref;
29201 }
29202 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
29203         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
29204         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
29205         return ret_conv;
29206 }
29207
29208 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
29209         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
29210         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29211         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
29212         uint64_t ret_ref = tag_ptr(ret_copy, true);
29213         return ret_ref;
29214 }
29215
29216 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
29217         void* o_ptr = untag_ptr(o);
29218         CHECK_ACCESS(o_ptr);
29219         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
29220         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
29221         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29222         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
29223         return tag_ptr(ret_conv, true);
29224 }
29225
29226 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
29227         void* e_ptr = untag_ptr(e);
29228         CHECK_ACCESS(e_ptr);
29229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29231         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29232         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
29233         return tag_ptr(ret_conv, true);
29234 }
29235
29236 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
29237         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
29238         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
29239         return ret_conv;
29240 }
29241
29242 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
29243         if (!ptr_is_owned(_res)) return;
29244         void* _res_ptr = untag_ptr(_res);
29245         CHECK_ACCESS(_res_ptr);
29246         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
29247         FREE(untag_ptr(_res));
29248         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
29249 }
29250
29251 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
29252         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29253         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
29254         return tag_ptr(ret_conv, true);
29255 }
29256 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
29257         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
29258         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
29259         return ret_conv;
29260 }
29261
29262 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
29263         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
29264         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29265         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
29266         return tag_ptr(ret_conv, true);
29267 }
29268
29269 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
29270         void* o_ptr = untag_ptr(o);
29271         CHECK_ACCESS(o_ptr);
29272         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
29273         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
29274         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29275         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
29276         uint64_t ret_ref = tag_ptr(ret_copy, true);
29277         return ret_ref;
29278 }
29279
29280 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
29281         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29282         *ret_copy = COption_HTLCDestinationZ_none();
29283         uint64_t ret_ref = tag_ptr(ret_copy, true);
29284         return ret_ref;
29285 }
29286
29287 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
29288         if (!ptr_is_owned(_res)) return;
29289         void* _res_ptr = untag_ptr(_res);
29290         CHECK_ACCESS(_res_ptr);
29291         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
29292         FREE(untag_ptr(_res));
29293         COption_HTLCDestinationZ_free(_res_conv);
29294 }
29295
29296 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
29297         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29298         *ret_copy = COption_HTLCDestinationZ_clone(arg);
29299         uint64_t ret_ref = tag_ptr(ret_copy, true);
29300         return ret_ref;
29301 }
29302 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
29303         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
29304         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
29305         return ret_conv;
29306 }
29307
29308 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
29309         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
29310         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29311         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
29312         uint64_t ret_ref = tag_ptr(ret_copy, true);
29313         return ret_ref;
29314 }
29315
29316 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
29317         void* o_ptr = untag_ptr(o);
29318         CHECK_ACCESS(o_ptr);
29319         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
29320         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
29321         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29322         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
29323         return tag_ptr(ret_conv, true);
29324 }
29325
29326 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
29327         void* e_ptr = untag_ptr(e);
29328         CHECK_ACCESS(e_ptr);
29329         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29330         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29331         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29332         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
29333         return tag_ptr(ret_conv, true);
29334 }
29335
29336 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
29337         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
29338         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
29339         return ret_conv;
29340 }
29341
29342 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
29343         if (!ptr_is_owned(_res)) return;
29344         void* _res_ptr = untag_ptr(_res);
29345         CHECK_ACCESS(_res_ptr);
29346         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
29347         FREE(untag_ptr(_res));
29348         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
29349 }
29350
29351 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
29352         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29353         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
29354         return tag_ptr(ret_conv, true);
29355 }
29356 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
29357         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
29358         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
29359         return ret_conv;
29360 }
29361
29362 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
29363         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
29364         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29365         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
29366         return tag_ptr(ret_conv, true);
29367 }
29368
29369 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
29370         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
29371         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29372         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
29373         return tag_ptr(ret_conv, true);
29374 }
29375
29376 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
29377         void* e_ptr = untag_ptr(e);
29378         CHECK_ACCESS(e_ptr);
29379         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29380         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29381         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29382         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
29383         return tag_ptr(ret_conv, true);
29384 }
29385
29386 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
29387         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
29388         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
29389         return ret_conv;
29390 }
29391
29392 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
29393         if (!ptr_is_owned(_res)) return;
29394         void* _res_ptr = untag_ptr(_res);
29395         CHECK_ACCESS(_res_ptr);
29396         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
29397         FREE(untag_ptr(_res));
29398         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
29399 }
29400
29401 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
29402         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29403         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
29404         return tag_ptr(ret_conv, true);
29405 }
29406 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
29407         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
29408         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
29409         return ret_conv;
29410 }
29411
29412 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
29413         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
29414         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29415         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
29416         return tag_ptr(ret_conv, true);
29417 }
29418
29419 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
29420         LDKU128 o_ref;
29421         CHECK(o->arr_len == 16);
29422         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
29423         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29424         *ret_copy = COption_U128Z_some(o_ref);
29425         uint64_t ret_ref = tag_ptr(ret_copy, true);
29426         return ret_ref;
29427 }
29428
29429 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
29430         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29431         *ret_copy = COption_U128Z_none();
29432         uint64_t ret_ref = tag_ptr(ret_copy, true);
29433         return ret_ref;
29434 }
29435
29436 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
29437         if (!ptr_is_owned(_res)) return;
29438         void* _res_ptr = untag_ptr(_res);
29439         CHECK_ACCESS(_res_ptr);
29440         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
29441         FREE(untag_ptr(_res));
29442         COption_U128Z_free(_res_conv);
29443 }
29444
29445 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
29446         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29447         *ret_copy = COption_U128Z_clone(arg);
29448         uint64_t ret_ref = tag_ptr(ret_copy, true);
29449         return ret_ref;
29450 }
29451 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
29452         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
29453         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
29454         return ret_conv;
29455 }
29456
29457 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
29458         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
29459         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29460         *ret_copy = COption_U128Z_clone(orig_conv);
29461         uint64_t ret_ref = tag_ptr(ret_copy, true);
29462         return ret_ref;
29463 }
29464
29465 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
29466         LDKCVec_ClaimedHTLCZ _res_constr;
29467         _res_constr.datalen = _res->arr_len;
29468         if (_res_constr.datalen > 0)
29469                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
29470         else
29471                 _res_constr.data = NULL;
29472         uint64_t* _res_vals = _res->elems;
29473         for (size_t n = 0; n < _res_constr.datalen; n++) {
29474                 uint64_t _res_conv_13 = _res_vals[n];
29475                 LDKClaimedHTLC _res_conv_13_conv;
29476                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
29477                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
29478                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
29479                 _res_constr.data[n] = _res_conv_13_conv;
29480         }
29481         FREE(_res);
29482         CVec_ClaimedHTLCZ_free(_res_constr);
29483 }
29484
29485 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
29486         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
29487         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29488         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
29489         uint64_t ret_ref = tag_ptr(ret_copy, true);
29490         return ret_ref;
29491 }
29492
29493 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
29494         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29495         *ret_copy = COption_PaymentFailureReasonZ_none();
29496         uint64_t ret_ref = tag_ptr(ret_copy, true);
29497         return ret_ref;
29498 }
29499
29500 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
29501         if (!ptr_is_owned(_res)) return;
29502         void* _res_ptr = untag_ptr(_res);
29503         CHECK_ACCESS(_res_ptr);
29504         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
29505         FREE(untag_ptr(_res));
29506         COption_PaymentFailureReasonZ_free(_res_conv);
29507 }
29508
29509 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
29510         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29511         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
29512         uint64_t ret_ref = tag_ptr(ret_copy, true);
29513         return ret_ref;
29514 }
29515 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
29516         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
29517         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
29518         return ret_conv;
29519 }
29520
29521 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
29522         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
29523         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29524         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
29525         uint64_t ret_ref = tag_ptr(ret_copy, true);
29526         return ret_ref;
29527 }
29528
29529 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
29530         void* o_ptr = untag_ptr(o);
29531         CHECK_ACCESS(o_ptr);
29532         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
29533         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
29534         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29535         *ret_copy = COption_EventZ_some(o_conv);
29536         uint64_t ret_ref = tag_ptr(ret_copy, true);
29537         return ret_ref;
29538 }
29539
29540 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
29541         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29542         *ret_copy = COption_EventZ_none();
29543         uint64_t ret_ref = tag_ptr(ret_copy, true);
29544         return ret_ref;
29545 }
29546
29547 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
29548         if (!ptr_is_owned(_res)) return;
29549         void* _res_ptr = untag_ptr(_res);
29550         CHECK_ACCESS(_res_ptr);
29551         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
29552         FREE(untag_ptr(_res));
29553         COption_EventZ_free(_res_conv);
29554 }
29555
29556 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
29557         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29558         *ret_copy = COption_EventZ_clone(arg);
29559         uint64_t ret_ref = tag_ptr(ret_copy, true);
29560         return ret_ref;
29561 }
29562 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
29563         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
29564         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
29565         return ret_conv;
29566 }
29567
29568 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
29569         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
29570         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29571         *ret_copy = COption_EventZ_clone(orig_conv);
29572         uint64_t ret_ref = tag_ptr(ret_copy, true);
29573         return ret_ref;
29574 }
29575
29576 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
29577         void* o_ptr = untag_ptr(o);
29578         CHECK_ACCESS(o_ptr);
29579         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
29580         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
29581         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29582         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
29583         return tag_ptr(ret_conv, true);
29584 }
29585
29586 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
29587         void* e_ptr = untag_ptr(e);
29588         CHECK_ACCESS(e_ptr);
29589         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29590         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29591         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29592         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
29593         return tag_ptr(ret_conv, true);
29594 }
29595
29596 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
29597         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
29598         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
29599         return ret_conv;
29600 }
29601
29602 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
29603         if (!ptr_is_owned(_res)) return;
29604         void* _res_ptr = untag_ptr(_res);
29605         CHECK_ACCESS(_res_ptr);
29606         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
29607         FREE(untag_ptr(_res));
29608         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
29609 }
29610
29611 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
29612         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29613         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
29614         return tag_ptr(ret_conv, true);
29615 }
29616 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
29617         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
29618         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
29619         return ret_conv;
29620 }
29621
29622 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
29623         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
29624         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29625         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
29626         return tag_ptr(ret_conv, true);
29627 }
29628
29629 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
29630         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
29631         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29632         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
29633         return tag_ptr(ret_conv, true);
29634 }
29635
29636 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
29637         void* e_ptr = untag_ptr(e);
29638         CHECK_ACCESS(e_ptr);
29639         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
29640         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
29641         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29642         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
29643         return tag_ptr(ret_conv, true);
29644 }
29645
29646 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
29647         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
29648         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
29649         return ret_conv;
29650 }
29651
29652 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
29653         if (!ptr_is_owned(_res)) return;
29654         void* _res_ptr = untag_ptr(_res);
29655         CHECK_ACCESS(_res_ptr);
29656         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
29657         FREE(untag_ptr(_res));
29658         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
29659 }
29660
29661 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
29662         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29663         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
29664         return tag_ptr(ret_conv, true);
29665 }
29666 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
29667         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
29668         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
29669         return ret_conv;
29670 }
29671
29672 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
29673         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
29674         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29675         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
29676         return tag_ptr(ret_conv, true);
29677 }
29678
29679 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
29680         LDKBolt11Invoice o_conv;
29681         o_conv.inner = untag_ptr(o);
29682         o_conv.is_owned = ptr_is_owned(o);
29683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29684         o_conv = Bolt11Invoice_clone(&o_conv);
29685         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29686         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
29687         return tag_ptr(ret_conv, true);
29688 }
29689
29690 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
29691         void* e_ptr = untag_ptr(e);
29692         CHECK_ACCESS(e_ptr);
29693         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
29694         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
29695         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29696         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
29697         return tag_ptr(ret_conv, true);
29698 }
29699
29700 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
29701         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
29702         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
29703         return ret_conv;
29704 }
29705
29706 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
29707         if (!ptr_is_owned(_res)) return;
29708         void* _res_ptr = untag_ptr(_res);
29709         CHECK_ACCESS(_res_ptr);
29710         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
29711         FREE(untag_ptr(_res));
29712         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
29713 }
29714
29715 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
29716         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29717         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
29718         return tag_ptr(ret_conv, true);
29719 }
29720 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
29721         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
29722         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
29723         return ret_conv;
29724 }
29725
29726 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
29727         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
29728         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29729         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
29730         return tag_ptr(ret_conv, true);
29731 }
29732
29733 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
29734         LDKSignedRawBolt11Invoice o_conv;
29735         o_conv.inner = untag_ptr(o);
29736         o_conv.is_owned = ptr_is_owned(o);
29737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29738         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
29739         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29740         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
29741         return tag_ptr(ret_conv, true);
29742 }
29743
29744 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
29745         void* e_ptr = untag_ptr(e);
29746         CHECK_ACCESS(e_ptr);
29747         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
29748         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
29749         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29750         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
29751         return tag_ptr(ret_conv, true);
29752 }
29753
29754 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
29755         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
29756         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
29757         return ret_conv;
29758 }
29759
29760 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
29761         if (!ptr_is_owned(_res)) return;
29762         void* _res_ptr = untag_ptr(_res);
29763         CHECK_ACCESS(_res_ptr);
29764         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
29765         FREE(untag_ptr(_res));
29766         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
29767 }
29768
29769 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
29770         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29771         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
29772         return tag_ptr(ret_conv, true);
29773 }
29774 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
29775         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
29776         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
29777         return ret_conv;
29778 }
29779
29780 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
29781         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
29782         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29783         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
29784         return tag_ptr(ret_conv, true);
29785 }
29786
29787 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
29788         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
29789         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
29790         return tag_ptr(ret_conv, true);
29791 }
29792 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
29793         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
29794         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
29795         return ret_conv;
29796 }
29797
29798 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
29799         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
29800         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
29801         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
29802         return tag_ptr(ret_conv, true);
29803 }
29804
29805 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
29806         LDKRawBolt11Invoice a_conv;
29807         a_conv.inner = untag_ptr(a);
29808         a_conv.is_owned = ptr_is_owned(a);
29809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29810         a_conv = RawBolt11Invoice_clone(&a_conv);
29811         LDKThirtyTwoBytes b_ref;
29812         CHECK(b->arr_len == 32);
29813         memcpy(b_ref.data, b->elems, 32); FREE(b);
29814         LDKBolt11InvoiceSignature c_conv;
29815         c_conv.inner = untag_ptr(c);
29816         c_conv.is_owned = ptr_is_owned(c);
29817         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
29818         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
29819         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
29820         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
29821         return tag_ptr(ret_conv, true);
29822 }
29823
29824 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
29825         if (!ptr_is_owned(_res)) return;
29826         void* _res_ptr = untag_ptr(_res);
29827         CHECK_ACCESS(_res_ptr);
29828         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
29829         FREE(untag_ptr(_res));
29830         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
29831 }
29832
29833 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
29834         LDKPayeePubKey o_conv;
29835         o_conv.inner = untag_ptr(o);
29836         o_conv.is_owned = ptr_is_owned(o);
29837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29838         o_conv = PayeePubKey_clone(&o_conv);
29839         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29840         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
29841         return tag_ptr(ret_conv, true);
29842 }
29843
29844 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
29845         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
29846         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29847         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
29848         return tag_ptr(ret_conv, true);
29849 }
29850
29851 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
29852         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
29853         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
29854         return ret_conv;
29855 }
29856
29857 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
29858         if (!ptr_is_owned(_res)) return;
29859         void* _res_ptr = untag_ptr(_res);
29860         CHECK_ACCESS(_res_ptr);
29861         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
29862         FREE(untag_ptr(_res));
29863         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
29864 }
29865
29866 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
29867         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29868         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
29869         return tag_ptr(ret_conv, true);
29870 }
29871 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
29872         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
29873         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
29874         return ret_conv;
29875 }
29876
29877 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
29878         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
29879         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29880         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
29881         return tag_ptr(ret_conv, true);
29882 }
29883
29884 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
29885         LDKCVec_PrivateRouteZ _res_constr;
29886         _res_constr.datalen = _res->arr_len;
29887         if (_res_constr.datalen > 0)
29888                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
29889         else
29890                 _res_constr.data = NULL;
29891         uint64_t* _res_vals = _res->elems;
29892         for (size_t o = 0; o < _res_constr.datalen; o++) {
29893                 uint64_t _res_conv_14 = _res_vals[o];
29894                 LDKPrivateRoute _res_conv_14_conv;
29895                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
29896                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
29897                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
29898                 _res_constr.data[o] = _res_conv_14_conv;
29899         }
29900         FREE(_res);
29901         CVec_PrivateRouteZ_free(_res_constr);
29902 }
29903
29904 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
29905         LDKPositiveTimestamp o_conv;
29906         o_conv.inner = untag_ptr(o);
29907         o_conv.is_owned = ptr_is_owned(o);
29908         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29909         o_conv = PositiveTimestamp_clone(&o_conv);
29910         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29911         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
29912         return tag_ptr(ret_conv, true);
29913 }
29914
29915 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
29916         LDKCreationError e_conv = LDKCreationError_from_js(e);
29917         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29918         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
29919         return tag_ptr(ret_conv, true);
29920 }
29921
29922 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
29923         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
29924         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
29925         return ret_conv;
29926 }
29927
29928 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
29929         if (!ptr_is_owned(_res)) return;
29930         void* _res_ptr = untag_ptr(_res);
29931         CHECK_ACCESS(_res_ptr);
29932         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
29933         FREE(untag_ptr(_res));
29934         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
29935 }
29936
29937 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
29938         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29939         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
29940         return tag_ptr(ret_conv, true);
29941 }
29942 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
29943         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
29944         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
29945         return ret_conv;
29946 }
29947
29948 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
29949         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
29950         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29951         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
29952         return tag_ptr(ret_conv, true);
29953 }
29954
29955 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
29956         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29957         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
29958         return tag_ptr(ret_conv, true);
29959 }
29960
29961 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
29962         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
29963         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29964         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
29965         return tag_ptr(ret_conv, true);
29966 }
29967
29968 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
29969         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
29970         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
29971         return ret_conv;
29972 }
29973
29974 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
29975         if (!ptr_is_owned(_res)) return;
29976         void* _res_ptr = untag_ptr(_res);
29977         CHECK_ACCESS(_res_ptr);
29978         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
29979         FREE(untag_ptr(_res));
29980         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
29981 }
29982
29983 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
29984         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29985         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
29986         return tag_ptr(ret_conv, true);
29987 }
29988 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
29989         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
29990         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
29991         return ret_conv;
29992 }
29993
29994 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
29995         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
29996         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29997         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
29998         return tag_ptr(ret_conv, true);
29999 }
30000
30001 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
30002         LDKBolt11Invoice o_conv;
30003         o_conv.inner = untag_ptr(o);
30004         o_conv.is_owned = ptr_is_owned(o);
30005         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30006         o_conv = Bolt11Invoice_clone(&o_conv);
30007         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30008         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
30009         return tag_ptr(ret_conv, true);
30010 }
30011
30012 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
30013         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
30014         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30015         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
30016         return tag_ptr(ret_conv, true);
30017 }
30018
30019 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
30020         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
30021         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
30022         return ret_conv;
30023 }
30024
30025 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
30026         if (!ptr_is_owned(_res)) return;
30027         void* _res_ptr = untag_ptr(_res);
30028         CHECK_ACCESS(_res_ptr);
30029         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
30030         FREE(untag_ptr(_res));
30031         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
30032 }
30033
30034 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
30035         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30036         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
30037         return tag_ptr(ret_conv, true);
30038 }
30039 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
30040         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
30041         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
30042         return ret_conv;
30043 }
30044
30045 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
30046         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
30047         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30048         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
30049         return tag_ptr(ret_conv, true);
30050 }
30051
30052 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
30053         LDKDescription o_conv;
30054         o_conv.inner = untag_ptr(o);
30055         o_conv.is_owned = ptr_is_owned(o);
30056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30057         o_conv = Description_clone(&o_conv);
30058         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30059         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
30060         return tag_ptr(ret_conv, true);
30061 }
30062
30063 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
30064         LDKCreationError e_conv = LDKCreationError_from_js(e);
30065         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30066         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
30067         return tag_ptr(ret_conv, true);
30068 }
30069
30070 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
30071         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
30072         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
30073         return ret_conv;
30074 }
30075
30076 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
30077         if (!ptr_is_owned(_res)) return;
30078         void* _res_ptr = untag_ptr(_res);
30079         CHECK_ACCESS(_res_ptr);
30080         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
30081         FREE(untag_ptr(_res));
30082         CResult_DescriptionCreationErrorZ_free(_res_conv);
30083 }
30084
30085 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
30086         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30087         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
30088         return tag_ptr(ret_conv, true);
30089 }
30090 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
30091         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
30092         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
30093         return ret_conv;
30094 }
30095
30096 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
30097         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
30098         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30099         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
30100         return tag_ptr(ret_conv, true);
30101 }
30102
30103 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
30104         LDKPrivateRoute o_conv;
30105         o_conv.inner = untag_ptr(o);
30106         o_conv.is_owned = ptr_is_owned(o);
30107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30108         o_conv = PrivateRoute_clone(&o_conv);
30109         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30110         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
30111         return tag_ptr(ret_conv, true);
30112 }
30113
30114 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
30115         LDKCreationError e_conv = LDKCreationError_from_js(e);
30116         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30117         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
30118         return tag_ptr(ret_conv, true);
30119 }
30120
30121 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
30122         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
30123         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
30124         return ret_conv;
30125 }
30126
30127 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
30128         if (!ptr_is_owned(_res)) return;
30129         void* _res_ptr = untag_ptr(_res);
30130         CHECK_ACCESS(_res_ptr);
30131         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
30132         FREE(untag_ptr(_res));
30133         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
30134 }
30135
30136 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
30137         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30138         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
30139         return tag_ptr(ret_conv, true);
30140 }
30141 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
30142         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
30143         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
30144         return ret_conv;
30145 }
30146
30147 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
30148         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
30149         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30150         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
30151         return tag_ptr(ret_conv, true);
30152 }
30153
30154 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
30155         LDKOutPoint o_conv;
30156         o_conv.inner = untag_ptr(o);
30157         o_conv.is_owned = ptr_is_owned(o);
30158         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30159         o_conv = OutPoint_clone(&o_conv);
30160         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30161         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
30162         return tag_ptr(ret_conv, true);
30163 }
30164
30165 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
30166         void* e_ptr = untag_ptr(e);
30167         CHECK_ACCESS(e_ptr);
30168         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30169         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30170         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30171         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
30172         return tag_ptr(ret_conv, true);
30173 }
30174
30175 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
30176         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
30177         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
30178         return ret_conv;
30179 }
30180
30181 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
30182         if (!ptr_is_owned(_res)) return;
30183         void* _res_ptr = untag_ptr(_res);
30184         CHECK_ACCESS(_res_ptr);
30185         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
30186         FREE(untag_ptr(_res));
30187         CResult_OutPointDecodeErrorZ_free(_res_conv);
30188 }
30189
30190 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
30191         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30192         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
30193         return tag_ptr(ret_conv, true);
30194 }
30195 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
30196         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
30197         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
30198         return ret_conv;
30199 }
30200
30201 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
30202         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
30203         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30204         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
30205         return tag_ptr(ret_conv, true);
30206 }
30207
30208 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
30209         LDKBigSize o_conv;
30210         o_conv.inner = untag_ptr(o);
30211         o_conv.is_owned = ptr_is_owned(o);
30212         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30213         o_conv = BigSize_clone(&o_conv);
30214         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30215         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
30216         return tag_ptr(ret_conv, true);
30217 }
30218
30219 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
30220         void* e_ptr = untag_ptr(e);
30221         CHECK_ACCESS(e_ptr);
30222         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30223         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30224         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30225         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
30226         return tag_ptr(ret_conv, true);
30227 }
30228
30229 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
30230         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
30231         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
30232         return ret_conv;
30233 }
30234
30235 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
30236         if (!ptr_is_owned(_res)) return;
30237         void* _res_ptr = untag_ptr(_res);
30238         CHECK_ACCESS(_res_ptr);
30239         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
30240         FREE(untag_ptr(_res));
30241         CResult_BigSizeDecodeErrorZ_free(_res_conv);
30242 }
30243
30244 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
30245         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30246         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
30247         return tag_ptr(ret_conv, true);
30248 }
30249 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
30250         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
30251         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
30252         return ret_conv;
30253 }
30254
30255 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
30256         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
30257         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30258         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
30259         return tag_ptr(ret_conv, true);
30260 }
30261
30262 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
30263         LDKHostname o_conv;
30264         o_conv.inner = untag_ptr(o);
30265         o_conv.is_owned = ptr_is_owned(o);
30266         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30267         o_conv = Hostname_clone(&o_conv);
30268         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30269         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
30270         return tag_ptr(ret_conv, true);
30271 }
30272
30273 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
30274         void* e_ptr = untag_ptr(e);
30275         CHECK_ACCESS(e_ptr);
30276         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30277         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30278         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30279         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
30280         return tag_ptr(ret_conv, true);
30281 }
30282
30283 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
30284         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
30285         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
30286         return ret_conv;
30287 }
30288
30289 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
30290         if (!ptr_is_owned(_res)) return;
30291         void* _res_ptr = untag_ptr(_res);
30292         CHECK_ACCESS(_res_ptr);
30293         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
30294         FREE(untag_ptr(_res));
30295         CResult_HostnameDecodeErrorZ_free(_res_conv);
30296 }
30297
30298 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
30299         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30300         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
30301         return tag_ptr(ret_conv, true);
30302 }
30303 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
30304         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
30305         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
30306         return ret_conv;
30307 }
30308
30309 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
30310         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
30311         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30312         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
30313         return tag_ptr(ret_conv, true);
30314 }
30315
30316 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
30317         LDKTransactionU16LenLimited o_conv;
30318         o_conv.inner = untag_ptr(o);
30319         o_conv.is_owned = ptr_is_owned(o);
30320         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30321         o_conv = TransactionU16LenLimited_clone(&o_conv);
30322         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30323         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
30324         return tag_ptr(ret_conv, true);
30325 }
30326
30327 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
30328         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30329         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
30330         return tag_ptr(ret_conv, true);
30331 }
30332
30333 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
30334         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
30335         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
30336         return ret_conv;
30337 }
30338
30339 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
30340         if (!ptr_is_owned(_res)) return;
30341         void* _res_ptr = untag_ptr(_res);
30342         CHECK_ACCESS(_res_ptr);
30343         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
30344         FREE(untag_ptr(_res));
30345         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
30346 }
30347
30348 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
30349         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30350         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
30351         return tag_ptr(ret_conv, true);
30352 }
30353 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
30354         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
30355         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
30356         return ret_conv;
30357 }
30358
30359 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
30360         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
30361         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30362         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
30363         return tag_ptr(ret_conv, true);
30364 }
30365
30366 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
30367         LDKTransactionU16LenLimited o_conv;
30368         o_conv.inner = untag_ptr(o);
30369         o_conv.is_owned = ptr_is_owned(o);
30370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30371         o_conv = TransactionU16LenLimited_clone(&o_conv);
30372         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30373         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
30374         return tag_ptr(ret_conv, true);
30375 }
30376
30377 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
30378         void* e_ptr = untag_ptr(e);
30379         CHECK_ACCESS(e_ptr);
30380         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30381         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30382         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30383         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
30384         return tag_ptr(ret_conv, true);
30385 }
30386
30387 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
30388         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
30389         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
30390         return ret_conv;
30391 }
30392
30393 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
30394         if (!ptr_is_owned(_res)) return;
30395         void* _res_ptr = untag_ptr(_res);
30396         CHECK_ACCESS(_res_ptr);
30397         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
30398         FREE(untag_ptr(_res));
30399         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
30400 }
30401
30402 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
30403         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30404         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
30405         return tag_ptr(ret_conv, true);
30406 }
30407 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
30408         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
30409         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
30410         return ret_conv;
30411 }
30412
30413 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
30414         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
30415         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30416         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
30417         return tag_ptr(ret_conv, true);
30418 }
30419
30420 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
30421         LDKUntrustedString o_conv;
30422         o_conv.inner = untag_ptr(o);
30423         o_conv.is_owned = ptr_is_owned(o);
30424         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30425         o_conv = UntrustedString_clone(&o_conv);
30426         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30427         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
30428         return tag_ptr(ret_conv, true);
30429 }
30430
30431 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
30432         void* e_ptr = untag_ptr(e);
30433         CHECK_ACCESS(e_ptr);
30434         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30435         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30436         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30437         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
30438         return tag_ptr(ret_conv, true);
30439 }
30440
30441 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
30442         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
30443         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
30444         return ret_conv;
30445 }
30446
30447 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
30448         if (!ptr_is_owned(_res)) return;
30449         void* _res_ptr = untag_ptr(_res);
30450         CHECK_ACCESS(_res_ptr);
30451         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
30452         FREE(untag_ptr(_res));
30453         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
30454 }
30455
30456 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
30457         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30458         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
30459         return tag_ptr(ret_conv, true);
30460 }
30461 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
30462         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
30463         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
30464         return ret_conv;
30465 }
30466
30467 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
30468         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
30469         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30470         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
30471         return tag_ptr(ret_conv, true);
30472 }
30473
30474 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
30475         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30476         *ret_conv = C2Tuple__u832u16Z_clone(arg);
30477         return tag_ptr(ret_conv, true);
30478 }
30479 int64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone_ptr"))) TS_C2Tuple__u832u16Z_clone_ptr(uint64_t arg) {
30480         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
30481         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
30482         return ret_conv;
30483 }
30484
30485 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone"))) TS_C2Tuple__u832u16Z_clone(uint64_t orig) {
30486         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
30487         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30488         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
30489         return tag_ptr(ret_conv, true);
30490 }
30491
30492 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_new"))) TS_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
30493         LDKThirtyTwoBytes a_ref;
30494         CHECK(a->arr_len == 32);
30495         memcpy(a_ref.data, a->elems, 32); FREE(a);
30496         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30497         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
30498         return tag_ptr(ret_conv, true);
30499 }
30500
30501 void  __attribute__((export_name("TS_C2Tuple__u832u16Z_free"))) TS_C2Tuple__u832u16Z_free(uint64_t _res) {
30502         if (!ptr_is_owned(_res)) return;
30503         void* _res_ptr = untag_ptr(_res);
30504         CHECK_ACCESS(_res_ptr);
30505         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
30506         FREE(untag_ptr(_res));
30507         C2Tuple__u832u16Z_free(_res_conv);
30508 }
30509
30510 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
30511         LDKPaymentRelay o_conv;
30512         o_conv.inner = untag_ptr(o);
30513         o_conv.is_owned = ptr_is_owned(o);
30514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30515         o_conv = PaymentRelay_clone(&o_conv);
30516         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30517         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
30518         return tag_ptr(ret_conv, true);
30519 }
30520
30521 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
30522         void* e_ptr = untag_ptr(e);
30523         CHECK_ACCESS(e_ptr);
30524         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30525         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30526         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30527         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
30528         return tag_ptr(ret_conv, true);
30529 }
30530
30531 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
30532         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
30533         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
30534         return ret_conv;
30535 }
30536
30537 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
30538         if (!ptr_is_owned(_res)) return;
30539         void* _res_ptr = untag_ptr(_res);
30540         CHECK_ACCESS(_res_ptr);
30541         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
30542         FREE(untag_ptr(_res));
30543         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
30544 }
30545
30546 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
30547         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30548         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
30549         return tag_ptr(ret_conv, true);
30550 }
30551 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
30552         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
30553         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
30554         return ret_conv;
30555 }
30556
30557 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
30558         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
30559         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30560         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
30561         return tag_ptr(ret_conv, true);
30562 }
30563
30564 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
30565         LDKPaymentConstraints o_conv;
30566         o_conv.inner = untag_ptr(o);
30567         o_conv.is_owned = ptr_is_owned(o);
30568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30569         o_conv = PaymentConstraints_clone(&o_conv);
30570         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30571         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
30572         return tag_ptr(ret_conv, true);
30573 }
30574
30575 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
30576         void* e_ptr = untag_ptr(e);
30577         CHECK_ACCESS(e_ptr);
30578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30580         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30581         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
30582         return tag_ptr(ret_conv, true);
30583 }
30584
30585 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
30586         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
30587         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
30588         return ret_conv;
30589 }
30590
30591 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
30592         if (!ptr_is_owned(_res)) return;
30593         void* _res_ptr = untag_ptr(_res);
30594         CHECK_ACCESS(_res_ptr);
30595         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
30596         FREE(untag_ptr(_res));
30597         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
30598 }
30599
30600 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
30601         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30602         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
30603         return tag_ptr(ret_conv, true);
30604 }
30605 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
30606         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
30607         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
30608         return ret_conv;
30609 }
30610
30611 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
30612         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
30613         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30614         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
30615         return tag_ptr(ret_conv, true);
30616 }
30617
30618 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
30619         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30620         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
30621         return tag_ptr(ret_conv, true);
30622 }
30623 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(uint64_t arg) {
30624         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
30625         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
30626         return ret_conv;
30627 }
30628
30629 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(uint64_t orig) {
30630         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
30631         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30632         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
30633         return tag_ptr(ret_conv, true);
30634 }
30635
30636 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, uint64_t b, uint64_t c) {
30637         LDKThirtyTwoBytes a_ref;
30638         CHECK(a->arr_len == 32);
30639         memcpy(a_ref.data, a->elems, 32); FREE(a);
30640         LDKRecipientOnionFields b_conv;
30641         b_conv.inner = untag_ptr(b);
30642         b_conv.is_owned = ptr_is_owned(b);
30643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30644         b_conv = RecipientOnionFields_clone(&b_conv);
30645         LDKRouteParameters c_conv;
30646         c_conv.inner = untag_ptr(c);
30647         c_conv.is_owned = ptr_is_owned(c);
30648         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30649         c_conv = RouteParameters_clone(&c_conv);
30650         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30651         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
30652         return tag_ptr(ret_conv, true);
30653 }
30654
30655 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(uint64_t _res) {
30656         if (!ptr_is_owned(_res)) return;
30657         void* _res_ptr = untag_ptr(_res);
30658         CHECK_ACCESS(_res_ptr);
30659         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
30660         FREE(untag_ptr(_res));
30661         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
30662 }
30663
30664 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(uint64_t o) {
30665         void* o_ptr = untag_ptr(o);
30666         CHECK_ACCESS(o_ptr);
30667         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
30668         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
30669         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30670         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
30671         return tag_ptr(ret_conv, true);
30672 }
30673
30674 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
30675         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30676         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
30677         return tag_ptr(ret_conv, true);
30678 }
30679
30680 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(uint64_t o) {
30681         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
30682         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
30683         return ret_conv;
30684 }
30685
30686 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(uint64_t _res) {
30687         if (!ptr_is_owned(_res)) return;
30688         void* _res_ptr = untag_ptr(_res);
30689         CHECK_ACCESS(_res_ptr);
30690         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
30691         FREE(untag_ptr(_res));
30692         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
30693 }
30694
30695 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
30696         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30697         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
30698         return tag_ptr(ret_conv, true);
30699 }
30700 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(uint64_t arg) {
30701         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
30702         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
30703         return ret_conv;
30704 }
30705
30706 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(uint64_t orig) {
30707         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
30708         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30709         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
30710         return tag_ptr(ret_conv, true);
30711 }
30712
30713 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
30714         LDKStr o_conv = str_ref_to_owned_c(o);
30715         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30716         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
30717         return tag_ptr(ret_conv, true);
30718 }
30719
30720 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
30721         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
30722         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30723         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
30724         return tag_ptr(ret_conv, true);
30725 }
30726
30727 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
30728         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
30729         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
30730         return ret_conv;
30731 }
30732
30733 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
30734         if (!ptr_is_owned(_res)) return;
30735         void* _res_ptr = untag_ptr(_res);
30736         CHECK_ACCESS(_res_ptr);
30737         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
30738         FREE(untag_ptr(_res));
30739         CResult_StrSecp256k1ErrorZ_free(_res_conv);
30740 }
30741
30742 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
30743         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30744         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
30745         return tag_ptr(ret_conv, true);
30746 }
30747 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
30748         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
30749         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
30750         return ret_conv;
30751 }
30752
30753 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
30754         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
30755         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30756         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
30757         return tag_ptr(ret_conv, true);
30758 }
30759
30760 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
30761         void* o_ptr = untag_ptr(o);
30762         CHECK_ACCESS(o_ptr);
30763         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
30764         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
30765         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30766         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
30767         return tag_ptr(ret_conv, true);
30768 }
30769
30770 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
30771         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
30772         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30773         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
30774         return tag_ptr(ret_conv, true);
30775 }
30776
30777 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
30778         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
30779         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
30780         return ret_conv;
30781 }
30782
30783 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
30784         if (!ptr_is_owned(_res)) return;
30785         void* _res_ptr = untag_ptr(_res);
30786         CHECK_ACCESS(_res_ptr);
30787         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
30788         FREE(untag_ptr(_res));
30789         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
30790 }
30791
30792 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
30793         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30794         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
30795         return tag_ptr(ret_conv, true);
30796 }
30797 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
30798         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
30799         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
30800         return ret_conv;
30801 }
30802
30803 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
30804         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
30805         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30806         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
30807         return tag_ptr(ret_conv, true);
30808 }
30809
30810 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
30811         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
30812         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
30813         return tag_ptr(ret_conv, true);
30814 }
30815 int64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(uint64_t arg) {
30816         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
30817         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
30818         return ret_conv;
30819 }
30820
30821 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(uint64_t orig) {
30822         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
30823         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
30824         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
30825         return tag_ptr(ret_conv, true);
30826 }
30827
30828 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(int8_tArray a, uint64_t b, uint64_t c) {
30829         LDKPublicKey a_ref;
30830         CHECK(a->arr_len == 33);
30831         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
30832         LDKOnionMessage b_conv;
30833         b_conv.inner = untag_ptr(b);
30834         b_conv.is_owned = ptr_is_owned(b);
30835         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30836         b_conv = OnionMessage_clone(&b_conv);
30837         void* c_ptr = untag_ptr(c);
30838         CHECK_ACCESS(c_ptr);
30839         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
30840         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
30841         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
30842         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
30843         return tag_ptr(ret_conv, true);
30844 }
30845
30846 void  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(uint64_t _res) {
30847         if (!ptr_is_owned(_res)) return;
30848         void* _res_ptr = untag_ptr(_res);
30849         CHECK_ACCESS(_res_ptr);
30850         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
30851         FREE(untag_ptr(_res));
30852         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
30853 }
30854
30855 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(uint64_t o) {
30856         void* o_ptr = untag_ptr(o);
30857         CHECK_ACCESS(o_ptr);
30858         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
30859         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
30860         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
30861         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
30862         return tag_ptr(ret_conv, true);
30863 }
30864
30865 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(uint64_t e) {
30866         void* e_ptr = untag_ptr(e);
30867         CHECK_ACCESS(e_ptr);
30868         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
30869         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
30870         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
30871         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
30872         return tag_ptr(ret_conv, true);
30873 }
30874
30875 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(uint64_t o) {
30876         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
30877         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
30878         return ret_conv;
30879 }
30880
30881 void  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(uint64_t _res) {
30882         if (!ptr_is_owned(_res)) return;
30883         void* _res_ptr = untag_ptr(_res);
30884         CHECK_ACCESS(_res_ptr);
30885         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
30886         FREE(untag_ptr(_res));
30887         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
30888 }
30889
30890 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
30891         void* o_ptr = untag_ptr(o);
30892         CHECK_ACCESS(o_ptr);
30893         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
30894         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
30895         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
30896         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
30897         return tag_ptr(ret_conv, true);
30898 }
30899
30900 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
30901         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
30902         *ret_conv = CResult_PeeledOnionNoneZ_err();
30903         return tag_ptr(ret_conv, true);
30904 }
30905
30906 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
30907         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
30908         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
30909         return ret_conv;
30910 }
30911
30912 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
30913         if (!ptr_is_owned(_res)) return;
30914         void* _res_ptr = untag_ptr(_res);
30915         CHECK_ACCESS(_res_ptr);
30916         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
30917         FREE(untag_ptr(_res));
30918         CResult_PeeledOnionNoneZ_free(_res_conv);
30919 }
30920
30921 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_ok"))) TS_CResult_SendSuccessSendErrorZ_ok(uint64_t o) {
30922         void* o_ptr = untag_ptr(o);
30923         CHECK_ACCESS(o_ptr);
30924         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
30925         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
30926         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
30927         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
30928         return tag_ptr(ret_conv, true);
30929 }
30930
30931 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_err"))) TS_CResult_SendSuccessSendErrorZ_err(uint64_t e) {
30932         void* e_ptr = untag_ptr(e);
30933         CHECK_ACCESS(e_ptr);
30934         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
30935         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
30936         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
30937         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
30938         return tag_ptr(ret_conv, true);
30939 }
30940
30941 jboolean  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_is_ok"))) TS_CResult_SendSuccessSendErrorZ_is_ok(uint64_t o) {
30942         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
30943         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
30944         return ret_conv;
30945 }
30946
30947 void  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_free"))) TS_CResult_SendSuccessSendErrorZ_free(uint64_t _res) {
30948         if (!ptr_is_owned(_res)) return;
30949         void* _res_ptr = untag_ptr(_res);
30950         CHECK_ACCESS(_res_ptr);
30951         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
30952         FREE(untag_ptr(_res));
30953         CResult_SendSuccessSendErrorZ_free(_res_conv);
30954 }
30955
30956 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
30957         LDKBlindedPath o_conv;
30958         o_conv.inner = untag_ptr(o);
30959         o_conv.is_owned = ptr_is_owned(o);
30960         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30961         o_conv = BlindedPath_clone(&o_conv);
30962         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
30963         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
30964         return tag_ptr(ret_conv, true);
30965 }
30966
30967 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
30968         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
30969         *ret_conv = CResult_BlindedPathNoneZ_err();
30970         return tag_ptr(ret_conv, true);
30971 }
30972
30973 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
30974         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
30975         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
30976         return ret_conv;
30977 }
30978
30979 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
30980         if (!ptr_is_owned(_res)) return;
30981         void* _res_ptr = untag_ptr(_res);
30982         CHECK_ACCESS(_res_ptr);
30983         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
30984         FREE(untag_ptr(_res));
30985         CResult_BlindedPathNoneZ_free(_res_conv);
30986 }
30987
30988 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
30989         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
30990         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
30991         return tag_ptr(ret_conv, true);
30992 }
30993 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
30994         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
30995         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
30996         return ret_conv;
30997 }
30998
30999 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
31000         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
31001         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31002         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
31003         return tag_ptr(ret_conv, true);
31004 }
31005
31006 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
31007         void* o_ptr = untag_ptr(o);
31008         CHECK_ACCESS(o_ptr);
31009         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
31010         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
31011         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31012         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
31013         return tag_ptr(ret_conv, true);
31014 }
31015
31016 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
31017         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31018         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
31019         return tag_ptr(ret_conv, true);
31020 }
31021
31022 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
31023         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
31024         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
31025         return ret_conv;
31026 }
31027
31028 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
31029         if (!ptr_is_owned(_res)) return;
31030         void* _res_ptr = untag_ptr(_res);
31031         CHECK_ACCESS(_res_ptr);
31032         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
31033         FREE(untag_ptr(_res));
31034         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
31035 }
31036
31037 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
31038         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31039         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
31040         return tag_ptr(ret_conv, true);
31041 }
31042 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
31043         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
31044         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
31045         return ret_conv;
31046 }
31047
31048 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
31049         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
31050         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31051         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
31052         return tag_ptr(ret_conv, true);
31053 }
31054
31055 void  __attribute__((export_name("TS_CVec_ForwardNodeZ_free"))) TS_CVec_ForwardNodeZ_free(uint64_tArray _res) {
31056         LDKCVec_ForwardNodeZ _res_constr;
31057         _res_constr.datalen = _res->arr_len;
31058         if (_res_constr.datalen > 0)
31059                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
31060         else
31061                 _res_constr.data = NULL;
31062         uint64_t* _res_vals = _res->elems;
31063         for (size_t n = 0; n < _res_constr.datalen; n++) {
31064                 uint64_t _res_conv_13 = _res_vals[n];
31065                 LDKForwardNode _res_conv_13_conv;
31066                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
31067                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
31068                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
31069                 _res_constr.data[n] = _res_conv_13_conv;
31070         }
31071         FREE(_res);
31072         CVec_ForwardNodeZ_free(_res_constr);
31073 }
31074
31075 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
31076         LDKBlindedPath o_conv;
31077         o_conv.inner = untag_ptr(o);
31078         o_conv.is_owned = ptr_is_owned(o);
31079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31080         o_conv = BlindedPath_clone(&o_conv);
31081         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31082         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
31083         return tag_ptr(ret_conv, true);
31084 }
31085
31086 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
31087         void* e_ptr = untag_ptr(e);
31088         CHECK_ACCESS(e_ptr);
31089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31091         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31092         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
31093         return tag_ptr(ret_conv, true);
31094 }
31095
31096 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
31097         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
31098         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
31099         return ret_conv;
31100 }
31101
31102 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
31103         if (!ptr_is_owned(_res)) return;
31104         void* _res_ptr = untag_ptr(_res);
31105         CHECK_ACCESS(_res_ptr);
31106         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
31107         FREE(untag_ptr(_res));
31108         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
31109 }
31110
31111 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
31112         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31113         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
31114         return tag_ptr(ret_conv, true);
31115 }
31116 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
31117         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
31118         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
31119         return ret_conv;
31120 }
31121
31122 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
31123         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
31124         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31125         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
31126         return tag_ptr(ret_conv, true);
31127 }
31128
31129 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
31130         LDKBlindedHop o_conv;
31131         o_conv.inner = untag_ptr(o);
31132         o_conv.is_owned = ptr_is_owned(o);
31133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31134         o_conv = BlindedHop_clone(&o_conv);
31135         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31136         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
31137         return tag_ptr(ret_conv, true);
31138 }
31139
31140 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
31141         void* e_ptr = untag_ptr(e);
31142         CHECK_ACCESS(e_ptr);
31143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31145         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31146         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
31147         return tag_ptr(ret_conv, true);
31148 }
31149
31150 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
31151         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
31152         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
31153         return ret_conv;
31154 }
31155
31156 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
31157         if (!ptr_is_owned(_res)) return;
31158         void* _res_ptr = untag_ptr(_res);
31159         CHECK_ACCESS(_res_ptr);
31160         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
31161         FREE(untag_ptr(_res));
31162         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
31163 }
31164
31165 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
31166         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31167         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
31168         return tag_ptr(ret_conv, true);
31169 }
31170 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
31171         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
31172         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
31173         return ret_conv;
31174 }
31175
31176 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
31177         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
31178         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31179         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
31180         return tag_ptr(ret_conv, true);
31181 }
31182
31183 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
31184         LDKInvoiceError o_conv;
31185         o_conv.inner = untag_ptr(o);
31186         o_conv.is_owned = ptr_is_owned(o);
31187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31188         o_conv = InvoiceError_clone(&o_conv);
31189         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31190         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
31191         return tag_ptr(ret_conv, true);
31192 }
31193
31194 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
31195         void* e_ptr = untag_ptr(e);
31196         CHECK_ACCESS(e_ptr);
31197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31199         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31200         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
31201         return tag_ptr(ret_conv, true);
31202 }
31203
31204 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
31205         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
31206         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
31207         return ret_conv;
31208 }
31209
31210 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
31211         if (!ptr_is_owned(_res)) return;
31212         void* _res_ptr = untag_ptr(_res);
31213         CHECK_ACCESS(_res_ptr);
31214         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
31215         FREE(untag_ptr(_res));
31216         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
31217 }
31218
31219 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
31220         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31221         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
31222         return tag_ptr(ret_conv, true);
31223 }
31224 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
31225         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
31226         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
31227         return ret_conv;
31228 }
31229
31230 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
31231         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
31232         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31233         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
31234         return tag_ptr(ret_conv, true);
31235 }
31236
31237 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(uint64_t o) {
31238         LDKDelayedPaymentBasepoint o_conv;
31239         o_conv.inner = untag_ptr(o);
31240         o_conv.is_owned = ptr_is_owned(o);
31241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31242         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
31243         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31244         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
31245         return tag_ptr(ret_conv, true);
31246 }
31247
31248 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err(uint64_t e) {
31249         void* e_ptr = untag_ptr(e);
31250         CHECK_ACCESS(e_ptr);
31251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31253         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31254         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
31255         return tag_ptr(ret_conv, true);
31256 }
31257
31258 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(uint64_t o) {
31259         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
31260         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
31261         return ret_conv;
31262 }
31263
31264 void  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free(uint64_t _res) {
31265         if (!ptr_is_owned(_res)) return;
31266         void* _res_ptr = untag_ptr(_res);
31267         CHECK_ACCESS(_res_ptr);
31268         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
31269         FREE(untag_ptr(_res));
31270         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
31271 }
31272
31273 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
31274         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31275         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
31276         return tag_ptr(ret_conv, true);
31277 }
31278 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
31279         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
31280         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
31281         return ret_conv;
31282 }
31283
31284 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(uint64_t orig) {
31285         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
31286         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31287         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
31288         return tag_ptr(ret_conv, true);
31289 }
31290
31291 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok(uint64_t o) {
31292         LDKDelayedPaymentKey o_conv;
31293         o_conv.inner = untag_ptr(o);
31294         o_conv.is_owned = ptr_is_owned(o);
31295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31296         o_conv = DelayedPaymentKey_clone(&o_conv);
31297         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31298         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
31299         return tag_ptr(ret_conv, true);
31300 }
31301
31302 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_err(uint64_t e) {
31303         void* e_ptr = untag_ptr(e);
31304         CHECK_ACCESS(e_ptr);
31305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31307         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31308         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
31309         return tag_ptr(ret_conv, true);
31310 }
31311
31312 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(uint64_t o) {
31313         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
31314         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
31315         return ret_conv;
31316 }
31317
31318 void  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_free"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_free(uint64_t _res) {
31319         if (!ptr_is_owned(_res)) return;
31320         void* _res_ptr = untag_ptr(_res);
31321         CHECK_ACCESS(_res_ptr);
31322         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
31323         FREE(untag_ptr(_res));
31324         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
31325 }
31326
31327 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
31328         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31329         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
31330         return tag_ptr(ret_conv, true);
31331 }
31332 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
31333         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
31334         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
31335         return ret_conv;
31336 }
31337
31338 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone(uint64_t orig) {
31339         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
31340         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31341         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
31342         return tag_ptr(ret_conv, true);
31343 }
31344
31345 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_ok(uint64_t o) {
31346         LDKHtlcBasepoint o_conv;
31347         o_conv.inner = untag_ptr(o);
31348         o_conv.is_owned = ptr_is_owned(o);
31349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31350         o_conv = HtlcBasepoint_clone(&o_conv);
31351         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31352         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
31353         return tag_ptr(ret_conv, true);
31354 }
31355
31356 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_err(uint64_t e) {
31357         void* e_ptr = untag_ptr(e);
31358         CHECK_ACCESS(e_ptr);
31359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31361         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31362         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
31363         return tag_ptr(ret_conv, true);
31364 }
31365
31366 jboolean  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_is_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_is_ok(uint64_t o) {
31367         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
31368         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
31369         return ret_conv;
31370 }
31371
31372 void  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_free"))) TS_CResult_HtlcBasepointDecodeErrorZ_free(uint64_t _res) {
31373         if (!ptr_is_owned(_res)) return;
31374         void* _res_ptr = untag_ptr(_res);
31375         CHECK_ACCESS(_res_ptr);
31376         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
31377         FREE(untag_ptr(_res));
31378         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
31379 }
31380
31381 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
31382         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31383         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
31384         return tag_ptr(ret_conv, true);
31385 }
31386 int64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
31387         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
31388         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
31389         return ret_conv;
31390 }
31391
31392 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone(uint64_t orig) {
31393         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
31394         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31395         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
31396         return tag_ptr(ret_conv, true);
31397 }
31398
31399 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_ok(uint64_t o) {
31400         LDKHtlcKey o_conv;
31401         o_conv.inner = untag_ptr(o);
31402         o_conv.is_owned = ptr_is_owned(o);
31403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31404         o_conv = HtlcKey_clone(&o_conv);
31405         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31406         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
31407         return tag_ptr(ret_conv, true);
31408 }
31409
31410 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_err"))) TS_CResult_HtlcKeyDecodeErrorZ_err(uint64_t e) {
31411         void* e_ptr = untag_ptr(e);
31412         CHECK_ACCESS(e_ptr);
31413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31415         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31416         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
31417         return tag_ptr(ret_conv, true);
31418 }
31419
31420 jboolean  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_is_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_is_ok(uint64_t o) {
31421         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
31422         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
31423         return ret_conv;
31424 }
31425
31426 void  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_free"))) TS_CResult_HtlcKeyDecodeErrorZ_free(uint64_t _res) {
31427         if (!ptr_is_owned(_res)) return;
31428         void* _res_ptr = untag_ptr(_res);
31429         CHECK_ACCESS(_res_ptr);
31430         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
31431         FREE(untag_ptr(_res));
31432         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
31433 }
31434
31435 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
31436         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31437         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
31438         return tag_ptr(ret_conv, true);
31439 }
31440 int64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
31441         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
31442         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
31443         return ret_conv;
31444 }
31445
31446 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone"))) TS_CResult_HtlcKeyDecodeErrorZ_clone(uint64_t orig) {
31447         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
31448         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31449         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
31450         return tag_ptr(ret_conv, true);
31451 }
31452
31453 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_ok(uint64_t o) {
31454         LDKRevocationBasepoint o_conv;
31455         o_conv.inner = untag_ptr(o);
31456         o_conv.is_owned = ptr_is_owned(o);
31457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31458         o_conv = RevocationBasepoint_clone(&o_conv);
31459         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31460         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
31461         return tag_ptr(ret_conv, true);
31462 }
31463
31464 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_err(uint64_t e) {
31465         void* e_ptr = untag_ptr(e);
31466         CHECK_ACCESS(e_ptr);
31467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31469         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31470         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
31471         return tag_ptr(ret_conv, true);
31472 }
31473
31474 jboolean  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_is_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_is_ok(uint64_t o) {
31475         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
31476         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
31477         return ret_conv;
31478 }
31479
31480 void  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_free"))) TS_CResult_RevocationBasepointDecodeErrorZ_free(uint64_t _res) {
31481         if (!ptr_is_owned(_res)) return;
31482         void* _res_ptr = untag_ptr(_res);
31483         CHECK_ACCESS(_res_ptr);
31484         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
31485         FREE(untag_ptr(_res));
31486         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
31487 }
31488
31489 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
31490         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31491         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
31492         return tag_ptr(ret_conv, true);
31493 }
31494 int64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
31495         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
31496         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
31497         return ret_conv;
31498 }
31499
31500 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone(uint64_t orig) {
31501         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
31502         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31503         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
31504         return tag_ptr(ret_conv, true);
31505 }
31506
31507 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_ok(uint64_t o) {
31508         LDKRevocationKey o_conv;
31509         o_conv.inner = untag_ptr(o);
31510         o_conv.is_owned = ptr_is_owned(o);
31511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31512         o_conv = RevocationKey_clone(&o_conv);
31513         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31514         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
31515         return tag_ptr(ret_conv, true);
31516 }
31517
31518 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_err"))) TS_CResult_RevocationKeyDecodeErrorZ_err(uint64_t e) {
31519         void* e_ptr = untag_ptr(e);
31520         CHECK_ACCESS(e_ptr);
31521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31523         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31524         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
31525         return tag_ptr(ret_conv, true);
31526 }
31527
31528 jboolean  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_is_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_is_ok(uint64_t o) {
31529         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
31530         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
31531         return ret_conv;
31532 }
31533
31534 void  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_free"))) TS_CResult_RevocationKeyDecodeErrorZ_free(uint64_t _res) {
31535         if (!ptr_is_owned(_res)) return;
31536         void* _res_ptr = untag_ptr(_res);
31537         CHECK_ACCESS(_res_ptr);
31538         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
31539         FREE(untag_ptr(_res));
31540         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
31541 }
31542
31543 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
31544         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31545         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
31546         return tag_ptr(ret_conv, true);
31547 }
31548 int64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
31549         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
31550         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
31551         return ret_conv;
31552 }
31553
31554 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone"))) TS_CResult_RevocationKeyDecodeErrorZ_clone(uint64_t orig) {
31555         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
31556         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31557         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
31558         return tag_ptr(ret_conv, true);
31559 }
31560
31561 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
31562         void* o_ptr = untag_ptr(o);
31563         CHECK_ACCESS(o_ptr);
31564         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
31565         if (o_conv.free == LDKFilter_JCalls_free) {
31566                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31567                 LDKFilter_JCalls_cloned(&o_conv);
31568         }
31569         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31570         *ret_copy = COption_FilterZ_some(o_conv);
31571         uint64_t ret_ref = tag_ptr(ret_copy, true);
31572         return ret_ref;
31573 }
31574
31575 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
31576         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31577         *ret_copy = COption_FilterZ_none();
31578         uint64_t ret_ref = tag_ptr(ret_copy, true);
31579         return ret_ref;
31580 }
31581
31582 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
31583         if (!ptr_is_owned(_res)) return;
31584         void* _res_ptr = untag_ptr(_res);
31585         CHECK_ACCESS(_res_ptr);
31586         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
31587         FREE(untag_ptr(_res));
31588         COption_FilterZ_free(_res_conv);
31589 }
31590
31591 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
31592         LDKLockedChannelMonitor o_conv;
31593         o_conv.inner = untag_ptr(o);
31594         o_conv.is_owned = ptr_is_owned(o);
31595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31596         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
31597         
31598         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31599         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
31600         return tag_ptr(ret_conv, true);
31601 }
31602
31603 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
31604         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31605         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
31606         return tag_ptr(ret_conv, true);
31607 }
31608
31609 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
31610         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
31611         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
31612         return ret_conv;
31613 }
31614
31615 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
31616         if (!ptr_is_owned(_res)) return;
31617         void* _res_ptr = untag_ptr(_res);
31618         CHECK_ACCESS(_res_ptr);
31619         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
31620         FREE(untag_ptr(_res));
31621         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
31622 }
31623
31624 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
31625         LDKCVec_OutPointZ _res_constr;
31626         _res_constr.datalen = _res->arr_len;
31627         if (_res_constr.datalen > 0)
31628                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
31629         else
31630                 _res_constr.data = NULL;
31631         uint64_t* _res_vals = _res->elems;
31632         for (size_t k = 0; k < _res_constr.datalen; k++) {
31633                 uint64_t _res_conv_10 = _res_vals[k];
31634                 LDKOutPoint _res_conv_10_conv;
31635                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
31636                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
31637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
31638                 _res_constr.data[k] = _res_conv_10_conv;
31639         }
31640         FREE(_res);
31641         CVec_OutPointZ_free(_res_constr);
31642 }
31643
31644 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
31645         LDKCVec_MonitorUpdateIdZ _res_constr;
31646         _res_constr.datalen = _res->arr_len;
31647         if (_res_constr.datalen > 0)
31648                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31649         else
31650                 _res_constr.data = NULL;
31651         uint64_t* _res_vals = _res->elems;
31652         for (size_t r = 0; r < _res_constr.datalen; r++) {
31653                 uint64_t _res_conv_17 = _res_vals[r];
31654                 LDKMonitorUpdateId _res_conv_17_conv;
31655                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
31656                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
31657                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
31658                 _res_constr.data[r] = _res_conv_17_conv;
31659         }
31660         FREE(_res);
31661         CVec_MonitorUpdateIdZ_free(_res_constr);
31662 }
31663
31664 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
31665         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31666         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
31667         return tag_ptr(ret_conv, true);
31668 }
31669 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
31670         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
31671         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
31672         return ret_conv;
31673 }
31674
31675 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
31676         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
31677         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31678         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
31679         return tag_ptr(ret_conv, true);
31680 }
31681
31682 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
31683         LDKOutPoint a_conv;
31684         a_conv.inner = untag_ptr(a);
31685         a_conv.is_owned = ptr_is_owned(a);
31686         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31687         a_conv = OutPoint_clone(&a_conv);
31688         LDKCVec_MonitorUpdateIdZ b_constr;
31689         b_constr.datalen = b->arr_len;
31690         if (b_constr.datalen > 0)
31691                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31692         else
31693                 b_constr.data = NULL;
31694         uint64_t* b_vals = b->elems;
31695         for (size_t r = 0; r < b_constr.datalen; r++) {
31696                 uint64_t b_conv_17 = b_vals[r];
31697                 LDKMonitorUpdateId b_conv_17_conv;
31698                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
31699                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
31700                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
31701                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
31702                 b_constr.data[r] = b_conv_17_conv;
31703         }
31704         FREE(b);
31705         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31706         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
31707         return tag_ptr(ret_conv, true);
31708 }
31709
31710 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
31711         if (!ptr_is_owned(_res)) return;
31712         void* _res_ptr = untag_ptr(_res);
31713         CHECK_ACCESS(_res_ptr);
31714         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
31715         FREE(untag_ptr(_res));
31716         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
31717 }
31718
31719 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
31720         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
31721         _res_constr.datalen = _res->arr_len;
31722         if (_res_constr.datalen > 0)
31723                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
31724         else
31725                 _res_constr.data = NULL;
31726         uint64_t* _res_vals = _res->elems;
31727         for (size_t p = 0; p < _res_constr.datalen; p++) {
31728                 uint64_t _res_conv_41 = _res_vals[p];
31729                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
31730                 CHECK_ACCESS(_res_conv_41_ptr);
31731                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
31732                 FREE(untag_ptr(_res_conv_41));
31733                 _res_constr.data[p] = _res_conv_41_conv;
31734         }
31735         FREE(_res);
31736         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
31737 }
31738
31739 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
31740         if (!ptr_is_owned(this_ptr)) return;
31741         void* this_ptr_ptr = untag_ptr(this_ptr);
31742         CHECK_ACCESS(this_ptr_ptr);
31743         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
31744         FREE(untag_ptr(this_ptr));
31745         APIError_free(this_ptr_conv);
31746 }
31747
31748 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
31749         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31750         *ret_copy = APIError_clone(arg);
31751         uint64_t ret_ref = tag_ptr(ret_copy, true);
31752         return ret_ref;
31753 }
31754 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
31755         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
31756         int64_t ret_conv = APIError_clone_ptr(arg_conv);
31757         return ret_conv;
31758 }
31759
31760 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
31761         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
31762         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31763         *ret_copy = APIError_clone(orig_conv);
31764         uint64_t ret_ref = tag_ptr(ret_copy, true);
31765         return ret_ref;
31766 }
31767
31768 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
31769         LDKStr err_conv = str_ref_to_owned_c(err);
31770         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31771         *ret_copy = APIError_apimisuse_error(err_conv);
31772         uint64_t ret_ref = tag_ptr(ret_copy, true);
31773         return ret_ref;
31774 }
31775
31776 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
31777         LDKStr err_conv = str_ref_to_owned_c(err);
31778         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31779         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
31780         uint64_t ret_ref = tag_ptr(ret_copy, true);
31781         return ret_ref;
31782 }
31783
31784 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
31785         LDKStr err_conv = str_ref_to_owned_c(err);
31786         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31787         *ret_copy = APIError_invalid_route(err_conv);
31788         uint64_t ret_ref = tag_ptr(ret_copy, true);
31789         return ret_ref;
31790 }
31791
31792 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
31793         LDKStr err_conv = str_ref_to_owned_c(err);
31794         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31795         *ret_copy = APIError_channel_unavailable(err_conv);
31796         uint64_t ret_ref = tag_ptr(ret_copy, true);
31797         return ret_ref;
31798 }
31799
31800 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
31801         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31802         *ret_copy = APIError_monitor_update_in_progress();
31803         uint64_t ret_ref = tag_ptr(ret_copy, true);
31804         return ret_ref;
31805 }
31806
31807 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
31808         LDKShutdownScript script_conv;
31809         script_conv.inner = untag_ptr(script);
31810         script_conv.is_owned = ptr_is_owned(script);
31811         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
31812         script_conv = ShutdownScript_clone(&script_conv);
31813         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31814         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
31815         uint64_t ret_ref = tag_ptr(ret_copy, true);
31816         return ret_ref;
31817 }
31818
31819 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
31820         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
31821         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
31822         jboolean ret_conv = APIError_eq(a_conv, b_conv);
31823         return ret_conv;
31824 }
31825
31826 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
31827         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
31828         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
31829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31831         CVec_u8Z_free(ret_var);
31832         return ret_arr;
31833 }
31834
31835 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
31836         LDKu8slice ser_ref;
31837         ser_ref.datalen = ser->arr_len;
31838         ser_ref.data = ser->elems;
31839         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31840         *ret_conv = APIError_read(ser_ref);
31841         FREE(ser);
31842         return tag_ptr(ret_conv, true);
31843 }
31844
31845 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
31846         LDKBigSize this_obj_conv;
31847         this_obj_conv.inner = untag_ptr(this_obj);
31848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31850         BigSize_free(this_obj_conv);
31851 }
31852
31853 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
31854         LDKBigSize this_ptr_conv;
31855         this_ptr_conv.inner = untag_ptr(this_ptr);
31856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31858         this_ptr_conv.is_owned = false;
31859         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
31860         return ret_conv;
31861 }
31862
31863 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
31864         LDKBigSize this_ptr_conv;
31865         this_ptr_conv.inner = untag_ptr(this_ptr);
31866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868         this_ptr_conv.is_owned = false;
31869         BigSize_set_a(&this_ptr_conv, val);
31870 }
31871
31872 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
31873         LDKBigSize ret_var = BigSize_new(a_arg);
31874         uint64_t ret_ref = 0;
31875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31877         return ret_ref;
31878 }
31879
31880 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
31881         LDKBigSize ret_var = BigSize_clone(arg);
31882         uint64_t ret_ref = 0;
31883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31885         return ret_ref;
31886 }
31887 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
31888         LDKBigSize arg_conv;
31889         arg_conv.inner = untag_ptr(arg);
31890         arg_conv.is_owned = ptr_is_owned(arg);
31891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31892         arg_conv.is_owned = false;
31893         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
31894         return ret_conv;
31895 }
31896
31897 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
31898         LDKBigSize orig_conv;
31899         orig_conv.inner = untag_ptr(orig);
31900         orig_conv.is_owned = ptr_is_owned(orig);
31901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31902         orig_conv.is_owned = false;
31903         LDKBigSize ret_var = BigSize_clone(&orig_conv);
31904         uint64_t ret_ref = 0;
31905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31907         return ret_ref;
31908 }
31909
31910 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
31911         LDKBigSize o_conv;
31912         o_conv.inner = untag_ptr(o);
31913         o_conv.is_owned = ptr_is_owned(o);
31914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31915         o_conv.is_owned = false;
31916         int64_t ret_conv = BigSize_hash(&o_conv);
31917         return ret_conv;
31918 }
31919
31920 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
31921         LDKBigSize a_conv;
31922         a_conv.inner = untag_ptr(a);
31923         a_conv.is_owned = ptr_is_owned(a);
31924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31925         a_conv.is_owned = false;
31926         LDKBigSize b_conv;
31927         b_conv.inner = untag_ptr(b);
31928         b_conv.is_owned = ptr_is_owned(b);
31929         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31930         b_conv.is_owned = false;
31931         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
31932         return ret_conv;
31933 }
31934
31935 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
31936         LDKBigSize obj_conv;
31937         obj_conv.inner = untag_ptr(obj);
31938         obj_conv.is_owned = ptr_is_owned(obj);
31939         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31940         obj_conv.is_owned = false;
31941         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
31942         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31943         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31944         CVec_u8Z_free(ret_var);
31945         return ret_arr;
31946 }
31947
31948 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
31949         LDKu8slice ser_ref;
31950         ser_ref.datalen = ser->arr_len;
31951         ser_ref.data = ser->elems;
31952         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31953         *ret_conv = BigSize_read(ser_ref);
31954         FREE(ser);
31955         return tag_ptr(ret_conv, true);
31956 }
31957
31958 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
31959         LDKHostname this_obj_conv;
31960         this_obj_conv.inner = untag_ptr(this_obj);
31961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31963         Hostname_free(this_obj_conv);
31964 }
31965
31966 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
31967         LDKHostname ret_var = Hostname_clone(arg);
31968         uint64_t ret_ref = 0;
31969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31971         return ret_ref;
31972 }
31973 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
31974         LDKHostname arg_conv;
31975         arg_conv.inner = untag_ptr(arg);
31976         arg_conv.is_owned = ptr_is_owned(arg);
31977         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31978         arg_conv.is_owned = false;
31979         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
31980         return ret_conv;
31981 }
31982
31983 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
31984         LDKHostname orig_conv;
31985         orig_conv.inner = untag_ptr(orig);
31986         orig_conv.is_owned = ptr_is_owned(orig);
31987         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31988         orig_conv.is_owned = false;
31989         LDKHostname ret_var = Hostname_clone(&orig_conv);
31990         uint64_t ret_ref = 0;
31991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31993         return ret_ref;
31994 }
31995
31996 int64_t  __attribute__((export_name("TS_Hostname_hash"))) TS_Hostname_hash(uint64_t o) {
31997         LDKHostname o_conv;
31998         o_conv.inner = untag_ptr(o);
31999         o_conv.is_owned = ptr_is_owned(o);
32000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32001         o_conv.is_owned = false;
32002         int64_t ret_conv = Hostname_hash(&o_conv);
32003         return ret_conv;
32004 }
32005
32006 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
32007         LDKHostname a_conv;
32008         a_conv.inner = untag_ptr(a);
32009         a_conv.is_owned = ptr_is_owned(a);
32010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32011         a_conv.is_owned = false;
32012         LDKHostname b_conv;
32013         b_conv.inner = untag_ptr(b);
32014         b_conv.is_owned = ptr_is_owned(b);
32015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32016         b_conv.is_owned = false;
32017         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
32018         return ret_conv;
32019 }
32020
32021 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
32022         LDKHostname this_arg_conv;
32023         this_arg_conv.inner = untag_ptr(this_arg);
32024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32026         this_arg_conv.is_owned = false;
32027         int8_t ret_conv = Hostname_len(&this_arg_conv);
32028         return ret_conv;
32029 }
32030
32031 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
32032         LDKHostname obj_conv;
32033         obj_conv.inner = untag_ptr(obj);
32034         obj_conv.is_owned = ptr_is_owned(obj);
32035         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32036         obj_conv.is_owned = false;
32037         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
32038         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32039         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32040         CVec_u8Z_free(ret_var);
32041         return ret_arr;
32042 }
32043
32044 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
32045         LDKu8slice ser_ref;
32046         ser_ref.datalen = ser->arr_len;
32047         ser_ref.data = ser->elems;
32048         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32049         *ret_conv = Hostname_read(ser_ref);
32050         FREE(ser);
32051         return tag_ptr(ret_conv, true);
32052 }
32053
32054 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
32055         LDKTransactionU16LenLimited this_obj_conv;
32056         this_obj_conv.inner = untag_ptr(this_obj);
32057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32059         TransactionU16LenLimited_free(this_obj_conv);
32060 }
32061
32062 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
32063         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
32064         uint64_t ret_ref = 0;
32065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32067         return ret_ref;
32068 }
32069 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
32070         LDKTransactionU16LenLimited arg_conv;
32071         arg_conv.inner = untag_ptr(arg);
32072         arg_conv.is_owned = ptr_is_owned(arg);
32073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32074         arg_conv.is_owned = false;
32075         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
32076         return ret_conv;
32077 }
32078
32079 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
32080         LDKTransactionU16LenLimited orig_conv;
32081         orig_conv.inner = untag_ptr(orig);
32082         orig_conv.is_owned = ptr_is_owned(orig);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32084         orig_conv.is_owned = false;
32085         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
32086         uint64_t ret_ref = 0;
32087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32089         return ret_ref;
32090 }
32091
32092 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_hash"))) TS_TransactionU16LenLimited_hash(uint64_t o) {
32093         LDKTransactionU16LenLimited o_conv;
32094         o_conv.inner = untag_ptr(o);
32095         o_conv.is_owned = ptr_is_owned(o);
32096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32097         o_conv.is_owned = false;
32098         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
32099         return ret_conv;
32100 }
32101
32102 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
32103         LDKTransactionU16LenLimited a_conv;
32104         a_conv.inner = untag_ptr(a);
32105         a_conv.is_owned = ptr_is_owned(a);
32106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32107         a_conv.is_owned = false;
32108         LDKTransactionU16LenLimited b_conv;
32109         b_conv.inner = untag_ptr(b);
32110         b_conv.is_owned = ptr_is_owned(b);
32111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32112         b_conv.is_owned = false;
32113         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
32114         return ret_conv;
32115 }
32116
32117 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
32118         LDKTransaction transaction_ref;
32119         transaction_ref.datalen = transaction->arr_len;
32120         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
32121         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
32122         transaction_ref.data_is_owned = true;
32123         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32124         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
32125         return tag_ptr(ret_conv, true);
32126 }
32127
32128 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
32129         LDKTransactionU16LenLimited this_arg_conv;
32130         this_arg_conv.inner = untag_ptr(this_arg);
32131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32133         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
32134         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
32135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32137         Transaction_free(ret_var);
32138         return ret_arr;
32139 }
32140
32141 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
32142         LDKTransactionU16LenLimited obj_conv;
32143         obj_conv.inner = untag_ptr(obj);
32144         obj_conv.is_owned = ptr_is_owned(obj);
32145         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32146         obj_conv.is_owned = false;
32147         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
32148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32150         CVec_u8Z_free(ret_var);
32151         return ret_arr;
32152 }
32153
32154 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
32155         LDKu8slice ser_ref;
32156         ser_ref.datalen = ser->arr_len;
32157         ser_ref.data = ser->elems;
32158         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32159         *ret_conv = TransactionU16LenLimited_read(ser_ref);
32160         FREE(ser);
32161         return tag_ptr(ret_conv, true);
32162 }
32163
32164 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
32165         LDKu8slice msg_ref;
32166         msg_ref.datalen = msg->arr_len;
32167         msg_ref.data = msg->elems;
32168         uint8_t sk_arr[32];
32169         CHECK(sk->arr_len == 32);
32170         memcpy(sk_arr, sk->elems, 32); FREE(sk);
32171         uint8_t (*sk_ref)[32] = &sk_arr;
32172         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
32173         *ret_conv = sign(msg_ref, sk_ref);
32174         FREE(msg);
32175         return tag_ptr(ret_conv, true);
32176 }
32177
32178 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
32179         LDKu8slice msg_ref;
32180         msg_ref.datalen = msg->arr_len;
32181         msg_ref.data = msg->elems;
32182         LDKStr sig_conv = str_ref_to_owned_c(sig);
32183         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
32184         *ret_conv = recover_pk(msg_ref, sig_conv);
32185         FREE(msg);
32186         return tag_ptr(ret_conv, true);
32187 }
32188
32189 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
32190         LDKu8slice msg_ref;
32191         msg_ref.datalen = msg->arr_len;
32192         msg_ref.data = msg->elems;
32193         LDKStr sig_conv = str_ref_to_owned_c(sig);
32194         LDKPublicKey pk_ref;
32195         CHECK(pk->arr_len == 33);
32196         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
32197         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
32198         FREE(msg);
32199         return ret_conv;
32200 }
32201
32202 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
32203         LDKu8slice hrp_bytes_ref;
32204         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
32205         hrp_bytes_ref.data = hrp_bytes->elems;
32206         LDKCVec_U5Z data_without_signature_constr;
32207         data_without_signature_constr.datalen = data_without_signature->arr_len;
32208         if (data_without_signature_constr.datalen > 0)
32209                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
32210         else
32211                 data_without_signature_constr.data = NULL;
32212         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
32213         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
32214                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
32215                 
32216                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
32217         }
32218         FREE(data_without_signature);
32219         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
32220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32222         CVec_u8Z_free(ret_var);
32223         FREE(hrp_bytes);
32224         return ret_arr;
32225 }
32226
32227 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
32228         if (!ptr_is_owned(this_ptr)) return;
32229         void* this_ptr_ptr = untag_ptr(this_ptr);
32230         CHECK_ACCESS(this_ptr_ptr);
32231         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
32232         FREE(untag_ptr(this_ptr));
32233         KVStore_free(this_ptr_conv);
32234 }
32235
32236 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
32237         if (!ptr_is_owned(this_ptr)) return;
32238         void* this_ptr_ptr = untag_ptr(this_ptr);
32239         CHECK_ACCESS(this_ptr_ptr);
32240         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
32241         FREE(untag_ptr(this_ptr));
32242         Persister_free(this_ptr_conv);
32243 }
32244
32245 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) {
32246         void* kv_store_ptr = untag_ptr(kv_store);
32247         CHECK_ACCESS(kv_store_ptr);
32248         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32249         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32251                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32252         }
32253         void* entropy_source_ptr = untag_ptr(entropy_source);
32254         CHECK_ACCESS(entropy_source_ptr);
32255         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32256         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32257                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32258                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32259         }
32260         void* signer_provider_ptr = untag_ptr(signer_provider);
32261         CHECK_ACCESS(signer_provider_ptr);
32262         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32263         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32264                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32265                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32266         }
32267         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32268         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
32269         return tag_ptr(ret_conv, true);
32270 }
32271
32272 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
32273         LDKMonitorUpdatingPersister this_obj_conv;
32274         this_obj_conv.inner = untag_ptr(this_obj);
32275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32277         MonitorUpdatingPersister_free(this_obj_conv);
32278 }
32279
32280 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) {
32281         void* kv_store_ptr = untag_ptr(kv_store);
32282         CHECK_ACCESS(kv_store_ptr);
32283         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32284         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32286                 LDKKVStore_JCalls_cloned(&kv_store_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* entropy_source_ptr = untag_ptr(entropy_source);
32296         CHECK_ACCESS(entropy_source_ptr);
32297         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32298         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32300                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32301         }
32302         void* signer_provider_ptr = untag_ptr(signer_provider);
32303         CHECK_ACCESS(signer_provider_ptr);
32304         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32305         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32306                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32307                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32308         }
32309         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_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_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) {
32317         LDKMonitorUpdatingPersister 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         void* broadcaster_ptr = untag_ptr(broadcaster);
32323         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32324         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32325         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32326         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32327         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32328         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32329         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
32330         return tag_ptr(ret_conv, true);
32331 }
32332
32333 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) {
32334         LDKMonitorUpdatingPersister this_arg_conv;
32335         this_arg_conv.inner = untag_ptr(this_arg);
32336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32338         this_arg_conv.is_owned = false;
32339         void* broadcaster_ptr = untag_ptr(broadcaster);
32340         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32341         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32342         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32343         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32344         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32345         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
32346         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32347         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
32348         return tag_ptr(ret_conv, true);
32349 }
32350
32351 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
32352         LDKMonitorUpdatingPersister this_arg_conv;
32353         this_arg_conv.inner = untag_ptr(this_arg);
32354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32356         this_arg_conv.is_owned = false;
32357         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
32358         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
32359         return tag_ptr(ret_conv, true);
32360 }
32361
32362 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
32363         LDKMonitorUpdatingPersister this_arg_conv;
32364         this_arg_conv.inner = untag_ptr(this_arg);
32365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32367         this_arg_conv.is_owned = false;
32368         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
32369         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
32370         return tag_ptr(ret_ret, true);
32371 }
32372
32373 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
32374         LDKUntrustedString this_obj_conv;
32375         this_obj_conv.inner = untag_ptr(this_obj);
32376         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32378         UntrustedString_free(this_obj_conv);
32379 }
32380
32381 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
32382         LDKUntrustedString this_ptr_conv;
32383         this_ptr_conv.inner = untag_ptr(this_ptr);
32384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32386         this_ptr_conv.is_owned = false;
32387         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
32388         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32389         Str_free(ret_str);
32390         return ret_conv;
32391 }
32392
32393 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
32394         LDKUntrustedString this_ptr_conv;
32395         this_ptr_conv.inner = untag_ptr(this_ptr);
32396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32398         this_ptr_conv.is_owned = false;
32399         LDKStr val_conv = str_ref_to_owned_c(val);
32400         UntrustedString_set_a(&this_ptr_conv, val_conv);
32401 }
32402
32403 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
32404         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32405         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
32406         uint64_t ret_ref = 0;
32407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32409         return ret_ref;
32410 }
32411
32412 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
32413         LDKUntrustedString ret_var = UntrustedString_clone(arg);
32414         uint64_t ret_ref = 0;
32415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32417         return ret_ref;
32418 }
32419 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
32420         LDKUntrustedString arg_conv;
32421         arg_conv.inner = untag_ptr(arg);
32422         arg_conv.is_owned = ptr_is_owned(arg);
32423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32424         arg_conv.is_owned = false;
32425         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
32426         return ret_conv;
32427 }
32428
32429 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
32430         LDKUntrustedString orig_conv;
32431         orig_conv.inner = untag_ptr(orig);
32432         orig_conv.is_owned = ptr_is_owned(orig);
32433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32434         orig_conv.is_owned = false;
32435         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
32436         uint64_t ret_ref = 0;
32437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32439         return ret_ref;
32440 }
32441
32442 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
32443         LDKUntrustedString a_conv;
32444         a_conv.inner = untag_ptr(a);
32445         a_conv.is_owned = ptr_is_owned(a);
32446         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32447         a_conv.is_owned = false;
32448         LDKUntrustedString b_conv;
32449         b_conv.inner = untag_ptr(b);
32450         b_conv.is_owned = ptr_is_owned(b);
32451         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32452         b_conv.is_owned = false;
32453         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
32454         return ret_conv;
32455 }
32456
32457 int64_t  __attribute__((export_name("TS_UntrustedString_hash"))) TS_UntrustedString_hash(uint64_t o) {
32458         LDKUntrustedString o_conv;
32459         o_conv.inner = untag_ptr(o);
32460         o_conv.is_owned = ptr_is_owned(o);
32461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32462         o_conv.is_owned = false;
32463         int64_t ret_conv = UntrustedString_hash(&o_conv);
32464         return ret_conv;
32465 }
32466
32467 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
32468         LDKUntrustedString obj_conv;
32469         obj_conv.inner = untag_ptr(obj);
32470         obj_conv.is_owned = ptr_is_owned(obj);
32471         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32472         obj_conv.is_owned = false;
32473         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
32474         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32475         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32476         CVec_u8Z_free(ret_var);
32477         return ret_arr;
32478 }
32479
32480 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
32481         LDKu8slice ser_ref;
32482         ser_ref.datalen = ser->arr_len;
32483         ser_ref.data = ser->elems;
32484         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32485         *ret_conv = UntrustedString_read(ser_ref);
32486         FREE(ser);
32487         return tag_ptr(ret_conv, true);
32488 }
32489
32490 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
32491         LDKPrintableString this_obj_conv;
32492         this_obj_conv.inner = untag_ptr(this_obj);
32493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32495         PrintableString_free(this_obj_conv);
32496 }
32497
32498 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
32499         LDKPrintableString this_ptr_conv;
32500         this_ptr_conv.inner = untag_ptr(this_ptr);
32501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32503         this_ptr_conv.is_owned = false;
32504         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
32505         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32506         Str_free(ret_str);
32507         return ret_conv;
32508 }
32509
32510 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
32511         LDKPrintableString this_ptr_conv;
32512         this_ptr_conv.inner = untag_ptr(this_ptr);
32513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32515         this_ptr_conv.is_owned = false;
32516         LDKStr val_conv = str_ref_to_owned_c(val);
32517         PrintableString_set_a(&this_ptr_conv, val_conv);
32518 }
32519
32520 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
32521         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32522         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
32523         uint64_t ret_ref = 0;
32524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32526         return ret_ref;
32527 }
32528
32529 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
32530         if (!ptr_is_owned(this_ptr)) return;
32531         void* this_ptr_ptr = untag_ptr(this_ptr);
32532         CHECK_ACCESS(this_ptr_ptr);
32533         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
32534         FREE(untag_ptr(this_ptr));
32535         FutureCallback_free(this_ptr_conv);
32536 }
32537
32538 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
32539         LDKFuture this_obj_conv;
32540         this_obj_conv.inner = untag_ptr(this_obj);
32541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32543         Future_free(this_obj_conv);
32544 }
32545
32546 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
32547         LDKFuture ret_var = Future_clone(arg);
32548         uint64_t ret_ref = 0;
32549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32551         return ret_ref;
32552 }
32553 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
32554         LDKFuture arg_conv;
32555         arg_conv.inner = untag_ptr(arg);
32556         arg_conv.is_owned = ptr_is_owned(arg);
32557         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32558         arg_conv.is_owned = false;
32559         int64_t ret_conv = Future_clone_ptr(&arg_conv);
32560         return ret_conv;
32561 }
32562
32563 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
32564         LDKFuture orig_conv;
32565         orig_conv.inner = untag_ptr(orig);
32566         orig_conv.is_owned = ptr_is_owned(orig);
32567         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32568         orig_conv.is_owned = false;
32569         LDKFuture ret_var = Future_clone(&orig_conv);
32570         uint64_t ret_ref = 0;
32571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32573         return ret_ref;
32574 }
32575
32576 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
32577         LDKFuture this_arg_conv;
32578         this_arg_conv.inner = untag_ptr(this_arg);
32579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32581         this_arg_conv.is_owned = false;
32582         void* callback_ptr = untag_ptr(callback);
32583         CHECK_ACCESS(callback_ptr);
32584         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
32585         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
32586                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32587                 LDKFutureCallback_JCalls_cloned(&callback_conv);
32588         }
32589         Future_register_callback_fn(&this_arg_conv, callback_conv);
32590 }
32591
32592 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
32593         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
32594         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
32595         return ret_conv;
32596 }
32597
32598 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
32599         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
32600         return ret_conv;
32601 }
32602
32603 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
32604         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
32605         return ret_conv;
32606 }
32607
32608 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
32609         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
32610         return ret_conv;
32611 }
32612
32613 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
32614         uint32_t ret_conv = LDKLevel_to_js(Level_info());
32615         return ret_conv;
32616 }
32617
32618 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
32619         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
32620         return ret_conv;
32621 }
32622
32623 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
32624         uint32_t ret_conv = LDKLevel_to_js(Level_error());
32625         return ret_conv;
32626 }
32627
32628 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
32629         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
32630         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
32631         jboolean ret_conv = Level_eq(a_conv, b_conv);
32632         return ret_conv;
32633 }
32634
32635 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
32636         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
32637         int64_t ret_conv = Level_hash(o_conv);
32638         return ret_conv;
32639 }
32640
32641 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
32642         uint32_t ret_conv = LDKLevel_to_js(Level_max());
32643         return ret_conv;
32644 }
32645
32646 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
32647         LDKRecord this_obj_conv;
32648         this_obj_conv.inner = untag_ptr(this_obj);
32649         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32651         Record_free(this_obj_conv);
32652 }
32653
32654 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
32655         LDKRecord this_ptr_conv;
32656         this_ptr_conv.inner = untag_ptr(this_ptr);
32657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32659         this_ptr_conv.is_owned = false;
32660         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
32661         return ret_conv;
32662 }
32663
32664 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
32665         LDKRecord this_ptr_conv;
32666         this_ptr_conv.inner = untag_ptr(this_ptr);
32667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32669         this_ptr_conv.is_owned = false;
32670         LDKLevel val_conv = LDKLevel_from_js(val);
32671         Record_set_level(&this_ptr_conv, val_conv);
32672 }
32673
32674 int8_tArray  __attribute__((export_name("TS_Record_get_peer_id"))) TS_Record_get_peer_id(uint64_t this_ptr) {
32675         LDKRecord this_ptr_conv;
32676         this_ptr_conv.inner = untag_ptr(this_ptr);
32677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32679         this_ptr_conv.is_owned = false;
32680         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32681         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
32682         return ret_arr;
32683 }
32684
32685 void  __attribute__((export_name("TS_Record_set_peer_id"))) TS_Record_set_peer_id(uint64_t this_ptr, int8_tArray val) {
32686         LDKRecord this_ptr_conv;
32687         this_ptr_conv.inner = untag_ptr(this_ptr);
32688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32690         this_ptr_conv.is_owned = false;
32691         LDKPublicKey val_ref;
32692         CHECK(val->arr_len == 33);
32693         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32694         Record_set_peer_id(&this_ptr_conv, val_ref);
32695 }
32696
32697 uint64_t  __attribute__((export_name("TS_Record_get_channel_id"))) TS_Record_get_channel_id(uint64_t this_ptr) {
32698         LDKRecord this_ptr_conv;
32699         this_ptr_conv.inner = untag_ptr(this_ptr);
32700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32702         this_ptr_conv.is_owned = false;
32703         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
32704         *ret_copy = Record_get_channel_id(&this_ptr_conv);
32705         uint64_t ret_ref = tag_ptr(ret_copy, true);
32706         return ret_ref;
32707 }
32708
32709 void  __attribute__((export_name("TS_Record_set_channel_id"))) TS_Record_set_channel_id(uint64_t this_ptr, uint64_t val) {
32710         LDKRecord this_ptr_conv;
32711         this_ptr_conv.inner = untag_ptr(this_ptr);
32712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32714         this_ptr_conv.is_owned = false;
32715         void* val_ptr = untag_ptr(val);
32716         CHECK_ACCESS(val_ptr);
32717         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
32718         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
32719         Record_set_channel_id(&this_ptr_conv, val_conv);
32720 }
32721
32722 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
32723         LDKRecord this_ptr_conv;
32724         this_ptr_conv.inner = untag_ptr(this_ptr);
32725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32727         this_ptr_conv.is_owned = false;
32728         LDKStr ret_str = Record_get_args(&this_ptr_conv);
32729         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32730         Str_free(ret_str);
32731         return ret_conv;
32732 }
32733
32734 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
32735         LDKRecord this_ptr_conv;
32736         this_ptr_conv.inner = untag_ptr(this_ptr);
32737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32739         this_ptr_conv.is_owned = false;
32740         LDKStr val_conv = str_ref_to_owned_c(val);
32741         Record_set_args(&this_ptr_conv, val_conv);
32742 }
32743
32744 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
32745         LDKRecord this_ptr_conv;
32746         this_ptr_conv.inner = untag_ptr(this_ptr);
32747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32749         this_ptr_conv.is_owned = false;
32750         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
32751         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32752         Str_free(ret_str);
32753         return ret_conv;
32754 }
32755
32756 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
32757         LDKRecord this_ptr_conv;
32758         this_ptr_conv.inner = untag_ptr(this_ptr);
32759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32761         this_ptr_conv.is_owned = false;
32762         LDKStr val_conv = str_ref_to_owned_c(val);
32763         Record_set_module_path(&this_ptr_conv, val_conv);
32764 }
32765
32766 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
32767         LDKRecord this_ptr_conv;
32768         this_ptr_conv.inner = untag_ptr(this_ptr);
32769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32771         this_ptr_conv.is_owned = false;
32772         LDKStr ret_str = Record_get_file(&this_ptr_conv);
32773         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32774         Str_free(ret_str);
32775         return ret_conv;
32776 }
32777
32778 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
32779         LDKRecord this_ptr_conv;
32780         this_ptr_conv.inner = untag_ptr(this_ptr);
32781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32783         this_ptr_conv.is_owned = false;
32784         LDKStr val_conv = str_ref_to_owned_c(val);
32785         Record_set_file(&this_ptr_conv, val_conv);
32786 }
32787
32788 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
32789         LDKRecord this_ptr_conv;
32790         this_ptr_conv.inner = untag_ptr(this_ptr);
32791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32793         this_ptr_conv.is_owned = false;
32794         int32_t ret_conv = Record_get_line(&this_ptr_conv);
32795         return ret_conv;
32796 }
32797
32798 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
32799         LDKRecord this_ptr_conv;
32800         this_ptr_conv.inner = untag_ptr(this_ptr);
32801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32803         this_ptr_conv.is_owned = false;
32804         Record_set_line(&this_ptr_conv, val);
32805 }
32806
32807 uint64_t  __attribute__((export_name("TS_Record_new"))) TS_Record_new(uint32_t level_arg, int8_tArray peer_id_arg, uint64_t channel_id_arg, jstring args_arg, jstring module_path_arg, jstring file_arg, int32_t line_arg) {
32808         LDKLevel level_arg_conv = LDKLevel_from_js(level_arg);
32809         LDKPublicKey peer_id_arg_ref;
32810         CHECK(peer_id_arg->arr_len == 33);
32811         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
32812         void* channel_id_arg_ptr = untag_ptr(channel_id_arg);
32813         CHECK_ACCESS(channel_id_arg_ptr);
32814         LDKCOption_ThirtyTwoBytesZ channel_id_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_arg_ptr);
32815         channel_id_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id_arg));
32816         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
32817         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
32818         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
32819         LDKRecord ret_var = Record_new(level_arg_conv, peer_id_arg_ref, channel_id_arg_conv, args_arg_conv, module_path_arg_conv, file_arg_conv, line_arg);
32820         uint64_t ret_ref = 0;
32821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32823         return ret_ref;
32824 }
32825
32826 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
32827         LDKRecord ret_var = Record_clone(arg);
32828         uint64_t ret_ref = 0;
32829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32831         return ret_ref;
32832 }
32833 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
32834         LDKRecord arg_conv;
32835         arg_conv.inner = untag_ptr(arg);
32836         arg_conv.is_owned = ptr_is_owned(arg);
32837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32838         arg_conv.is_owned = false;
32839         int64_t ret_conv = Record_clone_ptr(&arg_conv);
32840         return ret_conv;
32841 }
32842
32843 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
32844         LDKRecord orig_conv;
32845         orig_conv.inner = untag_ptr(orig);
32846         orig_conv.is_owned = ptr_is_owned(orig);
32847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32848         orig_conv.is_owned = false;
32849         LDKRecord ret_var = Record_clone(&orig_conv);
32850         uint64_t ret_ref = 0;
32851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32853         return ret_ref;
32854 }
32855
32856 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
32857         if (!ptr_is_owned(this_ptr)) return;
32858         void* this_ptr_ptr = untag_ptr(this_ptr);
32859         CHECK_ACCESS(this_ptr_ptr);
32860         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
32861         FREE(untag_ptr(this_ptr));
32862         Logger_free(this_ptr_conv);
32863 }
32864
32865 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
32866         LDKChannelHandshakeConfig this_obj_conv;
32867         this_obj_conv.inner = untag_ptr(this_obj);
32868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32870         ChannelHandshakeConfig_free(this_obj_conv);
32871 }
32872
32873 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
32874         LDKChannelHandshakeConfig this_ptr_conv;
32875         this_ptr_conv.inner = untag_ptr(this_ptr);
32876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32878         this_ptr_conv.is_owned = false;
32879         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
32880         return ret_conv;
32881 }
32882
32883 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
32884         LDKChannelHandshakeConfig this_ptr_conv;
32885         this_ptr_conv.inner = untag_ptr(this_ptr);
32886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32888         this_ptr_conv.is_owned = false;
32889         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
32890 }
32891
32892 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
32893         LDKChannelHandshakeConfig this_ptr_conv;
32894         this_ptr_conv.inner = untag_ptr(this_ptr);
32895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32897         this_ptr_conv.is_owned = false;
32898         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
32899         return ret_conv;
32900 }
32901
32902 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) {
32903         LDKChannelHandshakeConfig this_ptr_conv;
32904         this_ptr_conv.inner = untag_ptr(this_ptr);
32905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32907         this_ptr_conv.is_owned = false;
32908         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
32909 }
32910
32911 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
32912         LDKChannelHandshakeConfig this_ptr_conv;
32913         this_ptr_conv.inner = untag_ptr(this_ptr);
32914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32916         this_ptr_conv.is_owned = false;
32917         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
32918         return ret_conv;
32919 }
32920
32921 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) {
32922         LDKChannelHandshakeConfig this_ptr_conv;
32923         this_ptr_conv.inner = untag_ptr(this_ptr);
32924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32926         this_ptr_conv.is_owned = false;
32927         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
32928 }
32929
32930 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) {
32931         LDKChannelHandshakeConfig this_ptr_conv;
32932         this_ptr_conv.inner = untag_ptr(this_ptr);
32933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32935         this_ptr_conv.is_owned = false;
32936         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
32937         return ret_conv;
32938 }
32939
32940 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) {
32941         LDKChannelHandshakeConfig this_ptr_conv;
32942         this_ptr_conv.inner = untag_ptr(this_ptr);
32943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32945         this_ptr_conv.is_owned = false;
32946         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
32947 }
32948
32949 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
32950         LDKChannelHandshakeConfig this_ptr_conv;
32951         this_ptr_conv.inner = untag_ptr(this_ptr);
32952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32954         this_ptr_conv.is_owned = false;
32955         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
32956         return ret_conv;
32957 }
32958
32959 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
32960         LDKChannelHandshakeConfig this_ptr_conv;
32961         this_ptr_conv.inner = untag_ptr(this_ptr);
32962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32964         this_ptr_conv.is_owned = false;
32965         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
32966 }
32967
32968 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
32969         LDKChannelHandshakeConfig this_ptr_conv;
32970         this_ptr_conv.inner = untag_ptr(this_ptr);
32971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32973         this_ptr_conv.is_owned = false;
32974         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
32975         return ret_conv;
32976 }
32977
32978 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
32979         LDKChannelHandshakeConfig this_ptr_conv;
32980         this_ptr_conv.inner = untag_ptr(this_ptr);
32981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32983         this_ptr_conv.is_owned = false;
32984         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
32985 }
32986
32987 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
32988         LDKChannelHandshakeConfig this_ptr_conv;
32989         this_ptr_conv.inner = untag_ptr(this_ptr);
32990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32992         this_ptr_conv.is_owned = false;
32993         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
32994         return ret_conv;
32995 }
32996
32997 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
32998         LDKChannelHandshakeConfig this_ptr_conv;
32999         this_ptr_conv.inner = untag_ptr(this_ptr);
33000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33002         this_ptr_conv.is_owned = false;
33003         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
33004 }
33005
33006 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) {
33007         LDKChannelHandshakeConfig this_ptr_conv;
33008         this_ptr_conv.inner = untag_ptr(this_ptr);
33009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33011         this_ptr_conv.is_owned = false;
33012         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
33013         return ret_conv;
33014 }
33015
33016 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) {
33017         LDKChannelHandshakeConfig this_ptr_conv;
33018         this_ptr_conv.inner = untag_ptr(this_ptr);
33019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33021         this_ptr_conv.is_owned = false;
33022         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
33023 }
33024
33025 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) {
33026         LDKChannelHandshakeConfig this_ptr_conv;
33027         this_ptr_conv.inner = untag_ptr(this_ptr);
33028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33030         this_ptr_conv.is_owned = false;
33031         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
33032         return ret_conv;
33033 }
33034
33035 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) {
33036         LDKChannelHandshakeConfig this_ptr_conv;
33037         this_ptr_conv.inner = untag_ptr(this_ptr);
33038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33040         this_ptr_conv.is_owned = false;
33041         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
33042 }
33043
33044 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
33045         LDKChannelHandshakeConfig this_ptr_conv;
33046         this_ptr_conv.inner = untag_ptr(this_ptr);
33047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33049         this_ptr_conv.is_owned = false;
33050         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
33051         return ret_conv;
33052 }
33053
33054 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) {
33055         LDKChannelHandshakeConfig this_ptr_conv;
33056         this_ptr_conv.inner = untag_ptr(this_ptr);
33057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33059         this_ptr_conv.is_owned = false;
33060         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
33061 }
33062
33063 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) {
33064         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);
33065         uint64_t ret_ref = 0;
33066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33068         return ret_ref;
33069 }
33070
33071 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
33072         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
33073         uint64_t ret_ref = 0;
33074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33076         return ret_ref;
33077 }
33078 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
33079         LDKChannelHandshakeConfig arg_conv;
33080         arg_conv.inner = untag_ptr(arg);
33081         arg_conv.is_owned = ptr_is_owned(arg);
33082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33083         arg_conv.is_owned = false;
33084         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
33085         return ret_conv;
33086 }
33087
33088 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
33089         LDKChannelHandshakeConfig orig_conv;
33090         orig_conv.inner = untag_ptr(orig);
33091         orig_conv.is_owned = ptr_is_owned(orig);
33092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33093         orig_conv.is_owned = false;
33094         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
33095         uint64_t ret_ref = 0;
33096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33098         return ret_ref;
33099 }
33100
33101 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
33102         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
33103         uint64_t ret_ref = 0;
33104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33106         return ret_ref;
33107 }
33108
33109 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
33110         LDKChannelHandshakeLimits this_obj_conv;
33111         this_obj_conv.inner = untag_ptr(this_obj);
33112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33114         ChannelHandshakeLimits_free(this_obj_conv);
33115 }
33116
33117 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
33118         LDKChannelHandshakeLimits this_ptr_conv;
33119         this_ptr_conv.inner = untag_ptr(this_ptr);
33120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33122         this_ptr_conv.is_owned = false;
33123         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
33124         return ret_conv;
33125 }
33126
33127 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
33128         LDKChannelHandshakeLimits this_ptr_conv;
33129         this_ptr_conv.inner = untag_ptr(this_ptr);
33130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33132         this_ptr_conv.is_owned = false;
33133         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
33134 }
33135
33136 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
33137         LDKChannelHandshakeLimits this_ptr_conv;
33138         this_ptr_conv.inner = untag_ptr(this_ptr);
33139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33141         this_ptr_conv.is_owned = false;
33142         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
33143         return ret_conv;
33144 }
33145
33146 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
33147         LDKChannelHandshakeLimits this_ptr_conv;
33148         this_ptr_conv.inner = untag_ptr(this_ptr);
33149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33151         this_ptr_conv.is_owned = false;
33152         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
33153 }
33154
33155 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
33156         LDKChannelHandshakeLimits this_ptr_conv;
33157         this_ptr_conv.inner = untag_ptr(this_ptr);
33158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33160         this_ptr_conv.is_owned = false;
33161         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
33162         return ret_conv;
33163 }
33164
33165 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) {
33166         LDKChannelHandshakeLimits this_ptr_conv;
33167         this_ptr_conv.inner = untag_ptr(this_ptr);
33168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33170         this_ptr_conv.is_owned = false;
33171         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
33172 }
33173
33174 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) {
33175         LDKChannelHandshakeLimits this_ptr_conv;
33176         this_ptr_conv.inner = untag_ptr(this_ptr);
33177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33179         this_ptr_conv.is_owned = false;
33180         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
33181         return ret_conv;
33182 }
33183
33184 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) {
33185         LDKChannelHandshakeLimits this_ptr_conv;
33186         this_ptr_conv.inner = untag_ptr(this_ptr);
33187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33189         this_ptr_conv.is_owned = false;
33190         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33191 }
33192
33193 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
33194         LDKChannelHandshakeLimits this_ptr_conv;
33195         this_ptr_conv.inner = untag_ptr(this_ptr);
33196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33198         this_ptr_conv.is_owned = false;
33199         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
33200         return ret_conv;
33201 }
33202
33203 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) {
33204         LDKChannelHandshakeLimits this_ptr_conv;
33205         this_ptr_conv.inner = untag_ptr(this_ptr);
33206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33208         this_ptr_conv.is_owned = false;
33209         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
33210 }
33211
33212 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
33213         LDKChannelHandshakeLimits this_ptr_conv;
33214         this_ptr_conv.inner = untag_ptr(this_ptr);
33215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33217         this_ptr_conv.is_owned = false;
33218         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
33219         return ret_conv;
33220 }
33221
33222 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) {
33223         LDKChannelHandshakeLimits this_ptr_conv;
33224         this_ptr_conv.inner = untag_ptr(this_ptr);
33225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33227         this_ptr_conv.is_owned = false;
33228         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
33229 }
33230
33231 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
33232         LDKChannelHandshakeLimits this_ptr_conv;
33233         this_ptr_conv.inner = untag_ptr(this_ptr);
33234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33236         this_ptr_conv.is_owned = false;
33237         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
33238         return ret_conv;
33239 }
33240
33241 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
33242         LDKChannelHandshakeLimits this_ptr_conv;
33243         this_ptr_conv.inner = untag_ptr(this_ptr);
33244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33246         this_ptr_conv.is_owned = false;
33247         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
33248 }
33249
33250 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
33251         LDKChannelHandshakeLimits this_ptr_conv;
33252         this_ptr_conv.inner = untag_ptr(this_ptr);
33253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33255         this_ptr_conv.is_owned = false;
33256         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
33257         return ret_conv;
33258 }
33259
33260 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
33261         LDKChannelHandshakeLimits this_ptr_conv;
33262         this_ptr_conv.inner = untag_ptr(this_ptr);
33263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33265         this_ptr_conv.is_owned = false;
33266         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
33267 }
33268
33269 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
33270         LDKChannelHandshakeLimits this_ptr_conv;
33271         this_ptr_conv.inner = untag_ptr(this_ptr);
33272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33274         this_ptr_conv.is_owned = false;
33275         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
33276         return ret_conv;
33277 }
33278
33279 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
33280         LDKChannelHandshakeLimits this_ptr_conv;
33281         this_ptr_conv.inner = untag_ptr(this_ptr);
33282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33284         this_ptr_conv.is_owned = false;
33285         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
33286 }
33287
33288 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
33289         LDKChannelHandshakeLimits this_ptr_conv;
33290         this_ptr_conv.inner = untag_ptr(this_ptr);
33291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33293         this_ptr_conv.is_owned = false;
33294         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
33295         return ret_conv;
33296 }
33297
33298 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) {
33299         LDKChannelHandshakeLimits this_ptr_conv;
33300         this_ptr_conv.inner = untag_ptr(this_ptr);
33301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33303         this_ptr_conv.is_owned = false;
33304         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
33305 }
33306
33307 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) {
33308         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);
33309         uint64_t ret_ref = 0;
33310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33312         return ret_ref;
33313 }
33314
33315 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
33316         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
33317         uint64_t ret_ref = 0;
33318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33320         return ret_ref;
33321 }
33322 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
33323         LDKChannelHandshakeLimits arg_conv;
33324         arg_conv.inner = untag_ptr(arg);
33325         arg_conv.is_owned = ptr_is_owned(arg);
33326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33327         arg_conv.is_owned = false;
33328         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
33329         return ret_conv;
33330 }
33331
33332 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
33333         LDKChannelHandshakeLimits orig_conv;
33334         orig_conv.inner = untag_ptr(orig);
33335         orig_conv.is_owned = ptr_is_owned(orig);
33336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33337         orig_conv.is_owned = false;
33338         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
33339         uint64_t ret_ref = 0;
33340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33342         return ret_ref;
33343 }
33344
33345 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
33346         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
33347         uint64_t ret_ref = 0;
33348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33350         return ret_ref;
33351 }
33352
33353 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
33354         if (!ptr_is_owned(this_ptr)) return;
33355         void* this_ptr_ptr = untag_ptr(this_ptr);
33356         CHECK_ACCESS(this_ptr_ptr);
33357         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
33358         FREE(untag_ptr(this_ptr));
33359         MaxDustHTLCExposure_free(this_ptr_conv);
33360 }
33361
33362 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
33363         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33364         *ret_copy = MaxDustHTLCExposure_clone(arg);
33365         uint64_t ret_ref = tag_ptr(ret_copy, true);
33366         return ret_ref;
33367 }
33368 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
33369         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
33370         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
33371         return ret_conv;
33372 }
33373
33374 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
33375         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
33376         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33377         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
33378         uint64_t ret_ref = tag_ptr(ret_copy, true);
33379         return ret_ref;
33380 }
33381
33382 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
33383         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33384         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
33385         uint64_t ret_ref = tag_ptr(ret_copy, true);
33386         return ret_ref;
33387 }
33388
33389 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
33390         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33391         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
33392         uint64_t ret_ref = tag_ptr(ret_copy, true);
33393         return ret_ref;
33394 }
33395
33396 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
33397         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
33398         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
33399         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
33400         return ret_conv;
33401 }
33402
33403 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
33404         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
33405         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
33406         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33407         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33408         CVec_u8Z_free(ret_var);
33409         return ret_arr;
33410 }
33411
33412 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
33413         LDKu8slice ser_ref;
33414         ser_ref.datalen = ser->arr_len;
33415         ser_ref.data = ser->elems;
33416         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
33417         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
33418         FREE(ser);
33419         return tag_ptr(ret_conv, true);
33420 }
33421
33422 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
33423         LDKChannelConfig this_obj_conv;
33424         this_obj_conv.inner = untag_ptr(this_obj);
33425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33427         ChannelConfig_free(this_obj_conv);
33428 }
33429
33430 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
33431         LDKChannelConfig this_ptr_conv;
33432         this_ptr_conv.inner = untag_ptr(this_ptr);
33433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33435         this_ptr_conv.is_owned = false;
33436         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
33437         return ret_conv;
33438 }
33439
33440 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) {
33441         LDKChannelConfig this_ptr_conv;
33442         this_ptr_conv.inner = untag_ptr(this_ptr);
33443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33445         this_ptr_conv.is_owned = false;
33446         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
33447 }
33448
33449 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
33450         LDKChannelConfig this_ptr_conv;
33451         this_ptr_conv.inner = untag_ptr(this_ptr);
33452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33454         this_ptr_conv.is_owned = false;
33455         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
33456         return ret_conv;
33457 }
33458
33459 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) {
33460         LDKChannelConfig this_ptr_conv;
33461         this_ptr_conv.inner = untag_ptr(this_ptr);
33462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33464         this_ptr_conv.is_owned = false;
33465         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
33466 }
33467
33468 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
33469         LDKChannelConfig this_ptr_conv;
33470         this_ptr_conv.inner = untag_ptr(this_ptr);
33471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33473         this_ptr_conv.is_owned = false;
33474         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
33475         return ret_conv;
33476 }
33477
33478 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33479         LDKChannelConfig this_ptr_conv;
33480         this_ptr_conv.inner = untag_ptr(this_ptr);
33481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33483         this_ptr_conv.is_owned = false;
33484         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
33485 }
33486
33487 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
33488         LDKChannelConfig this_ptr_conv;
33489         this_ptr_conv.inner = untag_ptr(this_ptr);
33490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33492         this_ptr_conv.is_owned = false;
33493         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33494         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
33495         uint64_t ret_ref = tag_ptr(ret_copy, true);
33496         return ret_ref;
33497 }
33498
33499 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) {
33500         LDKChannelConfig this_ptr_conv;
33501         this_ptr_conv.inner = untag_ptr(this_ptr);
33502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33504         this_ptr_conv.is_owned = false;
33505         void* val_ptr = untag_ptr(val);
33506         CHECK_ACCESS(val_ptr);
33507         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
33508         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
33509         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
33510 }
33511
33512 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) {
33513         LDKChannelConfig this_ptr_conv;
33514         this_ptr_conv.inner = untag_ptr(this_ptr);
33515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33517         this_ptr_conv.is_owned = false;
33518         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
33519         return ret_conv;
33520 }
33521
33522 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) {
33523         LDKChannelConfig this_ptr_conv;
33524         this_ptr_conv.inner = untag_ptr(this_ptr);
33525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33527         this_ptr_conv.is_owned = false;
33528         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
33529 }
33530
33531 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
33532         LDKChannelConfig this_ptr_conv;
33533         this_ptr_conv.inner = untag_ptr(this_ptr);
33534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33536         this_ptr_conv.is_owned = false;
33537         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
33538         return ret_conv;
33539 }
33540
33541 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
33542         LDKChannelConfig this_ptr_conv;
33543         this_ptr_conv.inner = untag_ptr(this_ptr);
33544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33546         this_ptr_conv.is_owned = false;
33547         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
33548 }
33549
33550 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) {
33551         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
33552         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
33553         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
33554         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
33555         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);
33556         uint64_t ret_ref = 0;
33557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33559         return ret_ref;
33560 }
33561
33562 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
33563         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
33564         uint64_t ret_ref = 0;
33565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33567         return ret_ref;
33568 }
33569 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
33570         LDKChannelConfig arg_conv;
33571         arg_conv.inner = untag_ptr(arg);
33572         arg_conv.is_owned = ptr_is_owned(arg);
33573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33574         arg_conv.is_owned = false;
33575         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
33576         return ret_conv;
33577 }
33578
33579 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
33580         LDKChannelConfig orig_conv;
33581         orig_conv.inner = untag_ptr(orig);
33582         orig_conv.is_owned = ptr_is_owned(orig);
33583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33584         orig_conv.is_owned = false;
33585         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
33586         uint64_t ret_ref = 0;
33587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33589         return ret_ref;
33590 }
33591
33592 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
33593         LDKChannelConfig a_conv;
33594         a_conv.inner = untag_ptr(a);
33595         a_conv.is_owned = ptr_is_owned(a);
33596         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33597         a_conv.is_owned = false;
33598         LDKChannelConfig b_conv;
33599         b_conv.inner = untag_ptr(b);
33600         b_conv.is_owned = ptr_is_owned(b);
33601         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33602         b_conv.is_owned = false;
33603         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
33604         return ret_conv;
33605 }
33606
33607 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
33608         LDKChannelConfig this_arg_conv;
33609         this_arg_conv.inner = untag_ptr(this_arg);
33610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33612         this_arg_conv.is_owned = false;
33613         LDKChannelConfigUpdate update_conv;
33614         update_conv.inner = untag_ptr(update);
33615         update_conv.is_owned = ptr_is_owned(update);
33616         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
33617         update_conv.is_owned = false;
33618         ChannelConfig_apply(&this_arg_conv, &update_conv);
33619 }
33620
33621 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
33622         LDKChannelConfig ret_var = ChannelConfig_default();
33623         uint64_t ret_ref = 0;
33624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33626         return ret_ref;
33627 }
33628
33629 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
33630         LDKChannelConfig obj_conv;
33631         obj_conv.inner = untag_ptr(obj);
33632         obj_conv.is_owned = ptr_is_owned(obj);
33633         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33634         obj_conv.is_owned = false;
33635         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
33636         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33637         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33638         CVec_u8Z_free(ret_var);
33639         return ret_arr;
33640 }
33641
33642 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
33643         LDKu8slice ser_ref;
33644         ser_ref.datalen = ser->arr_len;
33645         ser_ref.data = ser->elems;
33646         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
33647         *ret_conv = ChannelConfig_read(ser_ref);
33648         FREE(ser);
33649         return tag_ptr(ret_conv, true);
33650 }
33651
33652 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
33653         LDKChannelConfigUpdate this_obj_conv;
33654         this_obj_conv.inner = untag_ptr(this_obj);
33655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33657         ChannelConfigUpdate_free(this_obj_conv);
33658 }
33659
33660 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
33661         LDKChannelConfigUpdate this_ptr_conv;
33662         this_ptr_conv.inner = untag_ptr(this_ptr);
33663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33665         this_ptr_conv.is_owned = false;
33666         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33667         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
33668         uint64_t ret_ref = tag_ptr(ret_copy, true);
33669         return ret_ref;
33670 }
33671
33672 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) {
33673         LDKChannelConfigUpdate this_ptr_conv;
33674         this_ptr_conv.inner = untag_ptr(this_ptr);
33675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33677         this_ptr_conv.is_owned = false;
33678         void* val_ptr = untag_ptr(val);
33679         CHECK_ACCESS(val_ptr);
33680         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33681         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33682         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
33683 }
33684
33685 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
33686         LDKChannelConfigUpdate this_ptr_conv;
33687         this_ptr_conv.inner = untag_ptr(this_ptr);
33688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33690         this_ptr_conv.is_owned = false;
33691         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33692         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
33693         uint64_t ret_ref = tag_ptr(ret_copy, true);
33694         return ret_ref;
33695 }
33696
33697 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) {
33698         LDKChannelConfigUpdate this_ptr_conv;
33699         this_ptr_conv.inner = untag_ptr(this_ptr);
33700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33702         this_ptr_conv.is_owned = false;
33703         void* val_ptr = untag_ptr(val);
33704         CHECK_ACCESS(val_ptr);
33705         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33706         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33707         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
33708 }
33709
33710 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
33711         LDKChannelConfigUpdate this_ptr_conv;
33712         this_ptr_conv.inner = untag_ptr(this_ptr);
33713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33715         this_ptr_conv.is_owned = false;
33716         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
33717         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33718         uint64_t ret_ref = tag_ptr(ret_copy, true);
33719         return ret_ref;
33720 }
33721
33722 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
33723         LDKChannelConfigUpdate this_ptr_conv;
33724         this_ptr_conv.inner = untag_ptr(this_ptr);
33725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33727         this_ptr_conv.is_owned = false;
33728         void* val_ptr = untag_ptr(val);
33729         CHECK_ACCESS(val_ptr);
33730         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
33731         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
33732         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
33733 }
33734
33735 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) {
33736         LDKChannelConfigUpdate this_ptr_conv;
33737         this_ptr_conv.inner = untag_ptr(this_ptr);
33738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33740         this_ptr_conv.is_owned = false;
33741         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
33742         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
33743         uint64_t ret_ref = tag_ptr(ret_copy, true);
33744         return ret_ref;
33745 }
33746
33747 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) {
33748         LDKChannelConfigUpdate this_ptr_conv;
33749         this_ptr_conv.inner = untag_ptr(this_ptr);
33750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33752         this_ptr_conv.is_owned = false;
33753         void* val_ptr = untag_ptr(val);
33754         CHECK_ACCESS(val_ptr);
33755         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
33756         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
33757         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
33758 }
33759
33760 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) {
33761         LDKChannelConfigUpdate this_ptr_conv;
33762         this_ptr_conv.inner = untag_ptr(this_ptr);
33763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33765         this_ptr_conv.is_owned = false;
33766         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33767         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
33768         uint64_t ret_ref = tag_ptr(ret_copy, true);
33769         return ret_ref;
33770 }
33771
33772 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) {
33773         LDKChannelConfigUpdate this_ptr_conv;
33774         this_ptr_conv.inner = untag_ptr(this_ptr);
33775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33777         this_ptr_conv.is_owned = false;
33778         void* val_ptr = untag_ptr(val);
33779         CHECK_ACCESS(val_ptr);
33780         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33781         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33782         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
33783 }
33784
33785 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) {
33786         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
33787         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
33788         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
33789         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
33790         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
33791         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
33792         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
33793         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
33794         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
33795         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
33796         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
33797         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
33798         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
33799         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
33800         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
33801         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
33802         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
33803         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
33804         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
33805         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
33806         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);
33807         uint64_t ret_ref = 0;
33808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33810         return ret_ref;
33811 }
33812
33813 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
33814         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
33815         uint64_t ret_ref = 0;
33816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33818         return ret_ref;
33819 }
33820
33821 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
33822         LDKUserConfig this_obj_conv;
33823         this_obj_conv.inner = untag_ptr(this_obj);
33824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33826         UserConfig_free(this_obj_conv);
33827 }
33828
33829 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
33830         LDKUserConfig this_ptr_conv;
33831         this_ptr_conv.inner = untag_ptr(this_ptr);
33832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33834         this_ptr_conv.is_owned = false;
33835         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
33836         uint64_t ret_ref = 0;
33837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33839         return ret_ref;
33840 }
33841
33842 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
33843         LDKUserConfig this_ptr_conv;
33844         this_ptr_conv.inner = untag_ptr(this_ptr);
33845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33847         this_ptr_conv.is_owned = false;
33848         LDKChannelHandshakeConfig val_conv;
33849         val_conv.inner = untag_ptr(val);
33850         val_conv.is_owned = ptr_is_owned(val);
33851         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33852         val_conv = ChannelHandshakeConfig_clone(&val_conv);
33853         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
33854 }
33855
33856 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
33857         LDKUserConfig this_ptr_conv;
33858         this_ptr_conv.inner = untag_ptr(this_ptr);
33859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33861         this_ptr_conv.is_owned = false;
33862         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
33863         uint64_t ret_ref = 0;
33864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33866         return ret_ref;
33867 }
33868
33869 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
33870         LDKUserConfig this_ptr_conv;
33871         this_ptr_conv.inner = untag_ptr(this_ptr);
33872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33874         this_ptr_conv.is_owned = false;
33875         LDKChannelHandshakeLimits val_conv;
33876         val_conv.inner = untag_ptr(val);
33877         val_conv.is_owned = ptr_is_owned(val);
33878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33879         val_conv = ChannelHandshakeLimits_clone(&val_conv);
33880         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
33881 }
33882
33883 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
33884         LDKUserConfig this_ptr_conv;
33885         this_ptr_conv.inner = untag_ptr(this_ptr);
33886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33888         this_ptr_conv.is_owned = false;
33889         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
33890         uint64_t ret_ref = 0;
33891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33893         return ret_ref;
33894 }
33895
33896 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
33897         LDKUserConfig this_ptr_conv;
33898         this_ptr_conv.inner = untag_ptr(this_ptr);
33899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33901         this_ptr_conv.is_owned = false;
33902         LDKChannelConfig val_conv;
33903         val_conv.inner = untag_ptr(val);
33904         val_conv.is_owned = ptr_is_owned(val);
33905         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33906         val_conv = ChannelConfig_clone(&val_conv);
33907         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
33908 }
33909
33910 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
33911         LDKUserConfig this_ptr_conv;
33912         this_ptr_conv.inner = untag_ptr(this_ptr);
33913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33915         this_ptr_conv.is_owned = false;
33916         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
33917         return ret_conv;
33918 }
33919
33920 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) {
33921         LDKUserConfig this_ptr_conv;
33922         this_ptr_conv.inner = untag_ptr(this_ptr);
33923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33925         this_ptr_conv.is_owned = false;
33926         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
33927 }
33928
33929 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
33930         LDKUserConfig this_ptr_conv;
33931         this_ptr_conv.inner = untag_ptr(this_ptr);
33932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33934         this_ptr_conv.is_owned = false;
33935         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
33936         return ret_conv;
33937 }
33938
33939 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
33940         LDKUserConfig this_ptr_conv;
33941         this_ptr_conv.inner = untag_ptr(this_ptr);
33942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33944         this_ptr_conv.is_owned = false;
33945         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
33946 }
33947
33948 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
33949         LDKUserConfig this_ptr_conv;
33950         this_ptr_conv.inner = untag_ptr(this_ptr);
33951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33953         this_ptr_conv.is_owned = false;
33954         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
33955         return ret_conv;
33956 }
33957
33958 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
33959         LDKUserConfig this_ptr_conv;
33960         this_ptr_conv.inner = untag_ptr(this_ptr);
33961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33963         this_ptr_conv.is_owned = false;
33964         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
33965 }
33966
33967 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
33968         LDKUserConfig this_ptr_conv;
33969         this_ptr_conv.inner = untag_ptr(this_ptr);
33970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33972         this_ptr_conv.is_owned = false;
33973         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
33974         return ret_conv;
33975 }
33976
33977 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
33978         LDKUserConfig this_ptr_conv;
33979         this_ptr_conv.inner = untag_ptr(this_ptr);
33980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33982         this_ptr_conv.is_owned = false;
33983         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
33984 }
33985
33986 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
33987         LDKUserConfig this_ptr_conv;
33988         this_ptr_conv.inner = untag_ptr(this_ptr);
33989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33991         this_ptr_conv.is_owned = false;
33992         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
33993         return ret_conv;
33994 }
33995
33996 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
33997         LDKUserConfig this_ptr_conv;
33998         this_ptr_conv.inner = untag_ptr(this_ptr);
33999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34001         this_ptr_conv.is_owned = false;
34002         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
34003 }
34004
34005 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) {
34006         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
34007         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
34008         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
34009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
34010         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
34011         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
34012         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
34013         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
34014         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
34015         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
34016         LDKChannelConfig channel_config_arg_conv;
34017         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
34018         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
34019         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
34020         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
34021         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);
34022         uint64_t ret_ref = 0;
34023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34025         return ret_ref;
34026 }
34027
34028 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
34029         LDKUserConfig ret_var = UserConfig_clone(arg);
34030         uint64_t ret_ref = 0;
34031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34033         return ret_ref;
34034 }
34035 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
34036         LDKUserConfig arg_conv;
34037         arg_conv.inner = untag_ptr(arg);
34038         arg_conv.is_owned = ptr_is_owned(arg);
34039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34040         arg_conv.is_owned = false;
34041         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
34042         return ret_conv;
34043 }
34044
34045 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
34046         LDKUserConfig orig_conv;
34047         orig_conv.inner = untag_ptr(orig);
34048         orig_conv.is_owned = ptr_is_owned(orig);
34049         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34050         orig_conv.is_owned = false;
34051         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
34052         uint64_t ret_ref = 0;
34053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34055         return ret_ref;
34056 }
34057
34058 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
34059         LDKUserConfig ret_var = UserConfig_default();
34060         uint64_t ret_ref = 0;
34061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34063         return ret_ref;
34064 }
34065
34066 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
34067         LDKBestBlock this_obj_conv;
34068         this_obj_conv.inner = untag_ptr(this_obj);
34069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34071         BestBlock_free(this_obj_conv);
34072 }
34073
34074 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
34075         LDKBestBlock ret_var = BestBlock_clone(arg);
34076         uint64_t ret_ref = 0;
34077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34079         return ret_ref;
34080 }
34081 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
34082         LDKBestBlock arg_conv;
34083         arg_conv.inner = untag_ptr(arg);
34084         arg_conv.is_owned = ptr_is_owned(arg);
34085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34086         arg_conv.is_owned = false;
34087         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
34088         return ret_conv;
34089 }
34090
34091 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
34092         LDKBestBlock orig_conv;
34093         orig_conv.inner = untag_ptr(orig);
34094         orig_conv.is_owned = ptr_is_owned(orig);
34095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34096         orig_conv.is_owned = false;
34097         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
34098         uint64_t ret_ref = 0;
34099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34101         return ret_ref;
34102 }
34103
34104 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
34105         LDKBestBlock a_conv;
34106         a_conv.inner = untag_ptr(a);
34107         a_conv.is_owned = ptr_is_owned(a);
34108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34109         a_conv.is_owned = false;
34110         LDKBestBlock b_conv;
34111         b_conv.inner = untag_ptr(b);
34112         b_conv.is_owned = ptr_is_owned(b);
34113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34114         b_conv.is_owned = false;
34115         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
34116         return ret_conv;
34117 }
34118
34119 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
34120         LDKNetwork network_conv = LDKNetwork_from_js(network);
34121         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
34122         uint64_t ret_ref = 0;
34123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34125         return ret_ref;
34126 }
34127
34128 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
34129         LDKThirtyTwoBytes block_hash_ref;
34130         CHECK(block_hash->arr_len == 32);
34131         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
34132         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
34133         uint64_t ret_ref = 0;
34134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34136         return ret_ref;
34137 }
34138
34139 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
34140         LDKBestBlock this_arg_conv;
34141         this_arg_conv.inner = untag_ptr(this_arg);
34142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34144         this_arg_conv.is_owned = false;
34145         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34146         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
34147         return ret_arr;
34148 }
34149
34150 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
34151         LDKBestBlock this_arg_conv;
34152         this_arg_conv.inner = untag_ptr(this_arg);
34153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34155         this_arg_conv.is_owned = false;
34156         int32_t ret_conv = BestBlock_height(&this_arg_conv);
34157         return ret_conv;
34158 }
34159
34160 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
34161         if (!ptr_is_owned(this_ptr)) return;
34162         void* this_ptr_ptr = untag_ptr(this_ptr);
34163         CHECK_ACCESS(this_ptr_ptr);
34164         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
34165         FREE(untag_ptr(this_ptr));
34166         Listen_free(this_ptr_conv);
34167 }
34168
34169 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
34170         if (!ptr_is_owned(this_ptr)) return;
34171         void* this_ptr_ptr = untag_ptr(this_ptr);
34172         CHECK_ACCESS(this_ptr_ptr);
34173         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
34174         FREE(untag_ptr(this_ptr));
34175         Confirm_free(this_ptr_conv);
34176 }
34177
34178 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
34179         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
34180         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
34181         return ret_conv;
34182 }
34183
34184 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
34185         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
34186         return ret_conv;
34187 }
34188
34189 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
34190         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
34191         return ret_conv;
34192 }
34193
34194 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
34195         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
34196         return ret_conv;
34197 }
34198
34199 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
34200         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
34201         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
34202         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
34203         return ret_conv;
34204 }
34205
34206 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
34207         if (!ptr_is_owned(this_ptr)) return;
34208         void* this_ptr_ptr = untag_ptr(this_ptr);
34209         CHECK_ACCESS(this_ptr_ptr);
34210         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
34211         FREE(untag_ptr(this_ptr));
34212         Watch_free(this_ptr_conv);
34213 }
34214
34215 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
34216         if (!ptr_is_owned(this_ptr)) return;
34217         void* this_ptr_ptr = untag_ptr(this_ptr);
34218         CHECK_ACCESS(this_ptr_ptr);
34219         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
34220         FREE(untag_ptr(this_ptr));
34221         Filter_free(this_ptr_conv);
34222 }
34223
34224 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
34225         LDKWatchedOutput this_obj_conv;
34226         this_obj_conv.inner = untag_ptr(this_obj);
34227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34229         WatchedOutput_free(this_obj_conv);
34230 }
34231
34232 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
34233         LDKWatchedOutput this_ptr_conv;
34234         this_ptr_conv.inner = untag_ptr(this_ptr);
34235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34237         this_ptr_conv.is_owned = false;
34238         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
34239         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
34240         uint64_t ret_ref = tag_ptr(ret_copy, true);
34241         return ret_ref;
34242 }
34243
34244 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
34245         LDKWatchedOutput this_ptr_conv;
34246         this_ptr_conv.inner = untag_ptr(this_ptr);
34247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34249         this_ptr_conv.is_owned = false;
34250         void* val_ptr = untag_ptr(val);
34251         CHECK_ACCESS(val_ptr);
34252         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
34253         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
34254         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
34255 }
34256
34257 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
34258         LDKWatchedOutput this_ptr_conv;
34259         this_ptr_conv.inner = untag_ptr(this_ptr);
34260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34262         this_ptr_conv.is_owned = false;
34263         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
34264         uint64_t ret_ref = 0;
34265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34267         return ret_ref;
34268 }
34269
34270 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
34271         LDKWatchedOutput this_ptr_conv;
34272         this_ptr_conv.inner = untag_ptr(this_ptr);
34273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34275         this_ptr_conv.is_owned = false;
34276         LDKOutPoint val_conv;
34277         val_conv.inner = untag_ptr(val);
34278         val_conv.is_owned = ptr_is_owned(val);
34279         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34280         val_conv = OutPoint_clone(&val_conv);
34281         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
34282 }
34283
34284 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
34285         LDKWatchedOutput this_ptr_conv;
34286         this_ptr_conv.inner = untag_ptr(this_ptr);
34287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34289         this_ptr_conv.is_owned = false;
34290         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
34291         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34292         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34293         CVec_u8Z_free(ret_var);
34294         return ret_arr;
34295 }
34296
34297 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
34298         LDKWatchedOutput this_ptr_conv;
34299         this_ptr_conv.inner = untag_ptr(this_ptr);
34300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34302         this_ptr_conv.is_owned = false;
34303         LDKCVec_u8Z val_ref;
34304         val_ref.datalen = val->arr_len;
34305         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34306         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34307         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
34308 }
34309
34310 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) {
34311         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
34312         CHECK_ACCESS(block_hash_arg_ptr);
34313         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
34314         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
34315         LDKOutPoint outpoint_arg_conv;
34316         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
34317         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
34318         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
34319         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
34320         LDKCVec_u8Z script_pubkey_arg_ref;
34321         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
34322         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34323         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
34324         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
34325         uint64_t ret_ref = 0;
34326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34328         return ret_ref;
34329 }
34330
34331 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
34332         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
34333         uint64_t ret_ref = 0;
34334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34336         return ret_ref;
34337 }
34338 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
34339         LDKWatchedOutput arg_conv;
34340         arg_conv.inner = untag_ptr(arg);
34341         arg_conv.is_owned = ptr_is_owned(arg);
34342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34343         arg_conv.is_owned = false;
34344         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
34345         return ret_conv;
34346 }
34347
34348 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
34349         LDKWatchedOutput orig_conv;
34350         orig_conv.inner = untag_ptr(orig);
34351         orig_conv.is_owned = ptr_is_owned(orig);
34352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34353         orig_conv.is_owned = false;
34354         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
34355         uint64_t ret_ref = 0;
34356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34358         return ret_ref;
34359 }
34360
34361 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
34362         LDKWatchedOutput a_conv;
34363         a_conv.inner = untag_ptr(a);
34364         a_conv.is_owned = ptr_is_owned(a);
34365         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34366         a_conv.is_owned = false;
34367         LDKWatchedOutput b_conv;
34368         b_conv.inner = untag_ptr(b);
34369         b_conv.is_owned = ptr_is_owned(b);
34370         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34371         b_conv.is_owned = false;
34372         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
34373         return ret_conv;
34374 }
34375
34376 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
34377         LDKWatchedOutput o_conv;
34378         o_conv.inner = untag_ptr(o);
34379         o_conv.is_owned = ptr_is_owned(o);
34380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34381         o_conv.is_owned = false;
34382         int64_t ret_conv = WatchedOutput_hash(&o_conv);
34383         return ret_conv;
34384 }
34385
34386 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
34387         if (!ptr_is_owned(this_ptr)) return;
34388         void* this_ptr_ptr = untag_ptr(this_ptr);
34389         CHECK_ACCESS(this_ptr_ptr);
34390         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
34391         FREE(untag_ptr(this_ptr));
34392         BroadcasterInterface_free(this_ptr_conv);
34393 }
34394
34395 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
34396         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
34397         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
34398         return ret_conv;
34399 }
34400
34401 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
34402         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
34403         return ret_conv;
34404 }
34405
34406 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
34407         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
34408         return ret_conv;
34409 }
34410
34411 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
34412         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
34413         return ret_conv;
34414 }
34415
34416 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
34417         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
34418         return ret_conv;
34419 }
34420
34421 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
34422         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
34423         return ret_conv;
34424 }
34425
34426 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
34427         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
34428         return ret_conv;
34429 }
34430
34431 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
34432         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
34433         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
34434         return ret_conv;
34435 }
34436
34437 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
34438         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
34439         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
34440         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
34441         return ret_conv;
34442 }
34443
34444 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
34445         if (!ptr_is_owned(this_ptr)) return;
34446         void* this_ptr_ptr = untag_ptr(this_ptr);
34447         CHECK_ACCESS(this_ptr_ptr);
34448         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
34449         FREE(untag_ptr(this_ptr));
34450         FeeEstimator_free(this_ptr_conv);
34451 }
34452
34453 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
34454         LDKMonitorUpdateId this_obj_conv;
34455         this_obj_conv.inner = untag_ptr(this_obj);
34456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34458         MonitorUpdateId_free(this_obj_conv);
34459 }
34460
34461 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
34462         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
34463         uint64_t ret_ref = 0;
34464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34466         return ret_ref;
34467 }
34468 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
34469         LDKMonitorUpdateId arg_conv;
34470         arg_conv.inner = untag_ptr(arg);
34471         arg_conv.is_owned = ptr_is_owned(arg);
34472         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34473         arg_conv.is_owned = false;
34474         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
34475         return ret_conv;
34476 }
34477
34478 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
34479         LDKMonitorUpdateId orig_conv;
34480         orig_conv.inner = untag_ptr(orig);
34481         orig_conv.is_owned = ptr_is_owned(orig);
34482         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34483         orig_conv.is_owned = false;
34484         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
34485         uint64_t ret_ref = 0;
34486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34488         return ret_ref;
34489 }
34490
34491 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
34492         LDKMonitorUpdateId o_conv;
34493         o_conv.inner = untag_ptr(o);
34494         o_conv.is_owned = ptr_is_owned(o);
34495         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34496         o_conv.is_owned = false;
34497         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
34498         return ret_conv;
34499 }
34500
34501 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
34502         LDKMonitorUpdateId a_conv;
34503         a_conv.inner = untag_ptr(a);
34504         a_conv.is_owned = ptr_is_owned(a);
34505         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34506         a_conv.is_owned = false;
34507         LDKMonitorUpdateId b_conv;
34508         b_conv.inner = untag_ptr(b);
34509         b_conv.is_owned = ptr_is_owned(b);
34510         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34511         b_conv.is_owned = false;
34512         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
34513         return ret_conv;
34514 }
34515
34516 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
34517         if (!ptr_is_owned(this_ptr)) return;
34518         void* this_ptr_ptr = untag_ptr(this_ptr);
34519         CHECK_ACCESS(this_ptr_ptr);
34520         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
34521         FREE(untag_ptr(this_ptr));
34522         Persist_free(this_ptr_conv);
34523 }
34524
34525 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
34526         LDKLockedChannelMonitor this_obj_conv;
34527         this_obj_conv.inner = untag_ptr(this_obj);
34528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34530         LockedChannelMonitor_free(this_obj_conv);
34531 }
34532
34533 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
34534         LDKChainMonitor this_obj_conv;
34535         this_obj_conv.inner = untag_ptr(this_obj);
34536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34538         ChainMonitor_free(this_obj_conv);
34539 }
34540
34541 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) {
34542         void* chain_source_ptr = untag_ptr(chain_source);
34543         CHECK_ACCESS(chain_source_ptr);
34544         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
34545         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
34546         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
34547                 // Manually implement clone for Java trait instances
34548                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
34549                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34550                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
34551                 }
34552         }
34553         void* broadcaster_ptr = untag_ptr(broadcaster);
34554         CHECK_ACCESS(broadcaster_ptr);
34555         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
34556         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34558                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
34559         }
34560         void* logger_ptr = untag_ptr(logger);
34561         CHECK_ACCESS(logger_ptr);
34562         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34563         if (logger_conv.free == LDKLogger_JCalls_free) {
34564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34565                 LDKLogger_JCalls_cloned(&logger_conv);
34566         }
34567         void* feeest_ptr = untag_ptr(feeest);
34568         CHECK_ACCESS(feeest_ptr);
34569         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
34570         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
34571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34572                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
34573         }
34574         void* persister_ptr = untag_ptr(persister);
34575         CHECK_ACCESS(persister_ptr);
34576         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
34577         if (persister_conv.free == LDKPersist_JCalls_free) {
34578                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34579                 LDKPersist_JCalls_cloned(&persister_conv);
34580         }
34581         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
34582         uint64_t ret_ref = 0;
34583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34585         return ret_ref;
34586 }
34587
34588 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
34589         LDKChainMonitor this_arg_conv;
34590         this_arg_conv.inner = untag_ptr(this_arg);
34591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34593         this_arg_conv.is_owned = false;
34594         LDKCVec_ChannelDetailsZ ignored_channels_constr;
34595         ignored_channels_constr.datalen = ignored_channels->arr_len;
34596         if (ignored_channels_constr.datalen > 0)
34597                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34598         else
34599                 ignored_channels_constr.data = NULL;
34600         uint64_t* ignored_channels_vals = ignored_channels->elems;
34601         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
34602                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
34603                 LDKChannelDetails ignored_channels_conv_16_conv;
34604                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
34605                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
34606                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
34607                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
34608                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
34609         }
34610         FREE(ignored_channels);
34611         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
34612         uint64_tArray ret_arr = NULL;
34613         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34614         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34615         for (size_t j = 0; j < ret_var.datalen; j++) {
34616                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
34617                 *ret_conv_9_copy = ret_var.data[j];
34618                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
34619                 ret_arr_ptr[j] = ret_conv_9_ref;
34620         }
34621         
34622         FREE(ret_var.data);
34623         return ret_arr;
34624 }
34625
34626 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
34627         LDKChainMonitor this_arg_conv;
34628         this_arg_conv.inner = untag_ptr(this_arg);
34629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34631         this_arg_conv.is_owned = false;
34632         LDKOutPoint funding_txo_conv;
34633         funding_txo_conv.inner = untag_ptr(funding_txo);
34634         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
34635         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
34636         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
34637         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34638         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
34639         return tag_ptr(ret_conv, true);
34640 }
34641
34642 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
34643         LDKChainMonitor this_arg_conv;
34644         this_arg_conv.inner = untag_ptr(this_arg);
34645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34647         this_arg_conv.is_owned = false;
34648         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
34649         uint64_tArray ret_arr = NULL;
34650         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34651         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34652         for (size_t k = 0; k < ret_var.datalen; k++) {
34653                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
34654                 uint64_t ret_conv_10_ref = 0;
34655                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
34656                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
34657                 ret_arr_ptr[k] = ret_conv_10_ref;
34658         }
34659         
34660         FREE(ret_var.data);
34661         return ret_arr;
34662 }
34663
34664 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
34665         LDKChainMonitor this_arg_conv;
34666         this_arg_conv.inner = untag_ptr(this_arg);
34667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34669         this_arg_conv.is_owned = false;
34670         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
34671         uint64_tArray ret_arr = NULL;
34672         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34673         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34674         for (size_t p = 0; p < ret_var.datalen; p++) {
34675                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34676                 *ret_conv_41_conv = ret_var.data[p];
34677                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
34678         }
34679         
34680         FREE(ret_var.data);
34681         return ret_arr;
34682 }
34683
34684 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) {
34685         LDKChainMonitor this_arg_conv;
34686         this_arg_conv.inner = untag_ptr(this_arg);
34687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34689         this_arg_conv.is_owned = false;
34690         LDKOutPoint funding_txo_conv;
34691         funding_txo_conv.inner = untag_ptr(funding_txo);
34692         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
34693         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
34694         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
34695         LDKMonitorUpdateId completed_update_id_conv;
34696         completed_update_id_conv.inner = untag_ptr(completed_update_id);
34697         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
34699         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
34700         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34701         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
34702         return tag_ptr(ret_conv, true);
34703 }
34704
34705 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
34706         LDKChainMonitor this_arg_conv;
34707         this_arg_conv.inner = untag_ptr(this_arg);
34708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34710         this_arg_conv.is_owned = false;
34711         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
34712         uint64_t ret_ref = 0;
34713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34715         return ret_ref;
34716 }
34717
34718 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
34719         LDKChainMonitor this_arg_conv;
34720         this_arg_conv.inner = untag_ptr(this_arg);
34721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34723         this_arg_conv.is_owned = false;
34724         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
34725 }
34726
34727 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
34728         LDKChainMonitor this_arg_conv;
34729         this_arg_conv.inner = untag_ptr(this_arg);
34730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34732         this_arg_conv.is_owned = false;
34733         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
34734         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
34735         return tag_ptr(ret_ret, true);
34736 }
34737
34738 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
34739         LDKChainMonitor this_arg_conv;
34740         this_arg_conv.inner = untag_ptr(this_arg);
34741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34743         this_arg_conv.is_owned = false;
34744         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
34745         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
34746         return tag_ptr(ret_ret, true);
34747 }
34748
34749 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
34750         LDKChainMonitor this_arg_conv;
34751         this_arg_conv.inner = untag_ptr(this_arg);
34752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34754         this_arg_conv.is_owned = false;
34755         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
34756         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
34757         return tag_ptr(ret_ret, true);
34758 }
34759
34760 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
34761         LDKChainMonitor this_arg_conv;
34762         this_arg_conv.inner = untag_ptr(this_arg);
34763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34765         this_arg_conv.is_owned = false;
34766         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
34767         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
34768         return tag_ptr(ret_ret, true);
34769 }
34770
34771 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
34772         LDKChannelMonitorUpdate this_obj_conv;
34773         this_obj_conv.inner = untag_ptr(this_obj);
34774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34776         ChannelMonitorUpdate_free(this_obj_conv);
34777 }
34778
34779 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
34780         LDKChannelMonitorUpdate this_ptr_conv;
34781         this_ptr_conv.inner = untag_ptr(this_ptr);
34782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34784         this_ptr_conv.is_owned = false;
34785         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
34786         return ret_conv;
34787 }
34788
34789 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
34790         LDKChannelMonitorUpdate this_ptr_conv;
34791         this_ptr_conv.inner = untag_ptr(this_ptr);
34792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34794         this_ptr_conv.is_owned = false;
34795         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
34796 }
34797
34798 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
34799         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
34800         uint64_t ret_ref = 0;
34801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34803         return ret_ref;
34804 }
34805 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
34806         LDKChannelMonitorUpdate arg_conv;
34807         arg_conv.inner = untag_ptr(arg);
34808         arg_conv.is_owned = ptr_is_owned(arg);
34809         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34810         arg_conv.is_owned = false;
34811         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
34812         return ret_conv;
34813 }
34814
34815 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
34816         LDKChannelMonitorUpdate orig_conv;
34817         orig_conv.inner = untag_ptr(orig);
34818         orig_conv.is_owned = ptr_is_owned(orig);
34819         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34820         orig_conv.is_owned = false;
34821         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
34822         uint64_t ret_ref = 0;
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34825         return ret_ref;
34826 }
34827
34828 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
34829         LDKChannelMonitorUpdate a_conv;
34830         a_conv.inner = untag_ptr(a);
34831         a_conv.is_owned = ptr_is_owned(a);
34832         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34833         a_conv.is_owned = false;
34834         LDKChannelMonitorUpdate b_conv;
34835         b_conv.inner = untag_ptr(b);
34836         b_conv.is_owned = ptr_is_owned(b);
34837         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34838         b_conv.is_owned = false;
34839         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
34840         return ret_conv;
34841 }
34842
34843 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
34844         LDKChannelMonitorUpdate obj_conv;
34845         obj_conv.inner = untag_ptr(obj);
34846         obj_conv.is_owned = ptr_is_owned(obj);
34847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34848         obj_conv.is_owned = false;
34849         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
34850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34852         CVec_u8Z_free(ret_var);
34853         return ret_arr;
34854 }
34855
34856 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
34857         LDKu8slice ser_ref;
34858         ser_ref.datalen = ser->arr_len;
34859         ser_ref.data = ser->elems;
34860         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
34861         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
34862         FREE(ser);
34863         return tag_ptr(ret_conv, true);
34864 }
34865
34866 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
34867         if (!ptr_is_owned(this_ptr)) return;
34868         void* this_ptr_ptr = untag_ptr(this_ptr);
34869         CHECK_ACCESS(this_ptr_ptr);
34870         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
34871         FREE(untag_ptr(this_ptr));
34872         MonitorEvent_free(this_ptr_conv);
34873 }
34874
34875 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
34876         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34877         *ret_copy = MonitorEvent_clone(arg);
34878         uint64_t ret_ref = tag_ptr(ret_copy, true);
34879         return ret_ref;
34880 }
34881 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
34882         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
34883         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
34884         return ret_conv;
34885 }
34886
34887 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
34888         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
34889         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34890         *ret_copy = MonitorEvent_clone(orig_conv);
34891         uint64_t ret_ref = tag_ptr(ret_copy, true);
34892         return ret_ref;
34893 }
34894
34895 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
34896         LDKHTLCUpdate a_conv;
34897         a_conv.inner = untag_ptr(a);
34898         a_conv.is_owned = ptr_is_owned(a);
34899         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34900         a_conv = HTLCUpdate_clone(&a_conv);
34901         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34902         *ret_copy = MonitorEvent_htlcevent(a_conv);
34903         uint64_t ret_ref = tag_ptr(ret_copy, true);
34904         return ret_ref;
34905 }
34906
34907 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
34908         LDKOutPoint a_conv;
34909         a_conv.inner = untag_ptr(a);
34910         a_conv.is_owned = ptr_is_owned(a);
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34912         a_conv = OutPoint_clone(&a_conv);
34913         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34914         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
34915         uint64_t ret_ref = tag_ptr(ret_copy, true);
34916         return ret_ref;
34917 }
34918
34919 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
34920         LDKOutPoint funding_txo_conv;
34921         funding_txo_conv.inner = untag_ptr(funding_txo);
34922         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
34923         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
34924         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
34925         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34926         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
34927         uint64_t ret_ref = tag_ptr(ret_copy, true);
34928         return ret_ref;
34929 }
34930
34931 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
34932         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
34933         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
34934         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
34935         return ret_conv;
34936 }
34937
34938 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
34939         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
34940         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
34941         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34942         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34943         CVec_u8Z_free(ret_var);
34944         return ret_arr;
34945 }
34946
34947 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
34948         LDKu8slice ser_ref;
34949         ser_ref.datalen = ser->arr_len;
34950         ser_ref.data = ser->elems;
34951         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
34952         *ret_conv = MonitorEvent_read(ser_ref);
34953         FREE(ser);
34954         return tag_ptr(ret_conv, true);
34955 }
34956
34957 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
34958         LDKHTLCUpdate this_obj_conv;
34959         this_obj_conv.inner = untag_ptr(this_obj);
34960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34962         HTLCUpdate_free(this_obj_conv);
34963 }
34964
34965 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
34966         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
34967         uint64_t ret_ref = 0;
34968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34970         return ret_ref;
34971 }
34972 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
34973         LDKHTLCUpdate arg_conv;
34974         arg_conv.inner = untag_ptr(arg);
34975         arg_conv.is_owned = ptr_is_owned(arg);
34976         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34977         arg_conv.is_owned = false;
34978         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
34979         return ret_conv;
34980 }
34981
34982 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
34983         LDKHTLCUpdate orig_conv;
34984         orig_conv.inner = untag_ptr(orig);
34985         orig_conv.is_owned = ptr_is_owned(orig);
34986         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34987         orig_conv.is_owned = false;
34988         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
34989         uint64_t ret_ref = 0;
34990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34992         return ret_ref;
34993 }
34994
34995 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
34996         LDKHTLCUpdate a_conv;
34997         a_conv.inner = untag_ptr(a);
34998         a_conv.is_owned = ptr_is_owned(a);
34999         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35000         a_conv.is_owned = false;
35001         LDKHTLCUpdate b_conv;
35002         b_conv.inner = untag_ptr(b);
35003         b_conv.is_owned = ptr_is_owned(b);
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35005         b_conv.is_owned = false;
35006         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
35007         return ret_conv;
35008 }
35009
35010 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
35011         LDKHTLCUpdate obj_conv;
35012         obj_conv.inner = untag_ptr(obj);
35013         obj_conv.is_owned = ptr_is_owned(obj);
35014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35015         obj_conv.is_owned = false;
35016         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
35017         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35018         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35019         CVec_u8Z_free(ret_var);
35020         return ret_arr;
35021 }
35022
35023 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
35024         LDKu8slice ser_ref;
35025         ser_ref.datalen = ser->arr_len;
35026         ser_ref.data = ser->elems;
35027         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
35028         *ret_conv = HTLCUpdate_read(ser_ref);
35029         FREE(ser);
35030         return tag_ptr(ret_conv, true);
35031 }
35032
35033 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
35034         if (!ptr_is_owned(this_ptr)) return;
35035         void* this_ptr_ptr = untag_ptr(this_ptr);
35036         CHECK_ACCESS(this_ptr_ptr);
35037         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
35038         FREE(untag_ptr(this_ptr));
35039         Balance_free(this_ptr_conv);
35040 }
35041
35042 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
35043         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35044         *ret_copy = Balance_clone(arg);
35045         uint64_t ret_ref = tag_ptr(ret_copy, true);
35046         return ret_ref;
35047 }
35048 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
35049         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
35050         int64_t ret_conv = Balance_clone_ptr(arg_conv);
35051         return ret_conv;
35052 }
35053
35054 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
35055         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
35056         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35057         *ret_copy = Balance_clone(orig_conv);
35058         uint64_t ret_ref = tag_ptr(ret_copy, true);
35059         return ret_ref;
35060 }
35061
35062 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
35063         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35064         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
35065         uint64_t ret_ref = tag_ptr(ret_copy, true);
35066         return ret_ref;
35067 }
35068
35069 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
35070         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35071         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
35072         uint64_t ret_ref = tag_ptr(ret_copy, true);
35073         return ret_ref;
35074 }
35075
35076 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) {
35077         LDKThirtyTwoBytes payment_hash_ref;
35078         CHECK(payment_hash->arr_len == 32);
35079         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35080         LDKThirtyTwoBytes payment_preimage_ref;
35081         CHECK(payment_preimage->arr_len == 32);
35082         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35083         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35084         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
35085         uint64_t ret_ref = tag_ptr(ret_copy, true);
35086         return ret_ref;
35087 }
35088
35089 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) {
35090         LDKThirtyTwoBytes payment_hash_ref;
35091         CHECK(payment_hash->arr_len == 32);
35092         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35093         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35094         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
35095         uint64_t ret_ref = tag_ptr(ret_copy, true);
35096         return ret_ref;
35097 }
35098
35099 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) {
35100         LDKThirtyTwoBytes payment_hash_ref;
35101         CHECK(payment_hash->arr_len == 32);
35102         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35103         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35104         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
35105         uint64_t ret_ref = tag_ptr(ret_copy, true);
35106         return ret_ref;
35107 }
35108
35109 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
35110         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35111         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
35112         uint64_t ret_ref = tag_ptr(ret_copy, true);
35113         return ret_ref;
35114 }
35115
35116 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
35117         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
35118         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
35119         jboolean ret_conv = Balance_eq(a_conv, b_conv);
35120         return ret_conv;
35121 }
35122
35123 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
35124         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
35125         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
35126         return ret_conv;
35127 }
35128
35129 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
35130         LDKChannelMonitor this_obj_conv;
35131         this_obj_conv.inner = untag_ptr(this_obj);
35132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35134         ChannelMonitor_free(this_obj_conv);
35135 }
35136
35137 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
35138         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
35139         uint64_t ret_ref = 0;
35140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35142         return ret_ref;
35143 }
35144 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
35145         LDKChannelMonitor arg_conv;
35146         arg_conv.inner = untag_ptr(arg);
35147         arg_conv.is_owned = ptr_is_owned(arg);
35148         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35149         arg_conv.is_owned = false;
35150         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
35151         return ret_conv;
35152 }
35153
35154 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
35155         LDKChannelMonitor orig_conv;
35156         orig_conv.inner = untag_ptr(orig);
35157         orig_conv.is_owned = ptr_is_owned(orig);
35158         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35159         orig_conv.is_owned = false;
35160         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
35161         uint64_t ret_ref = 0;
35162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35164         return ret_ref;
35165 }
35166
35167 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
35168         LDKChannelMonitor obj_conv;
35169         obj_conv.inner = untag_ptr(obj);
35170         obj_conv.is_owned = ptr_is_owned(obj);
35171         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35172         obj_conv.is_owned = false;
35173         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
35174         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35175         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35176         CVec_u8Z_free(ret_var);
35177         return ret_arr;
35178 }
35179
35180 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) {
35181         LDKChannelMonitor this_arg_conv;
35182         this_arg_conv.inner = untag_ptr(this_arg);
35183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35185         this_arg_conv.is_owned = false;
35186         LDKChannelMonitorUpdate updates_conv;
35187         updates_conv.inner = untag_ptr(updates);
35188         updates_conv.is_owned = ptr_is_owned(updates);
35189         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
35190         updates_conv.is_owned = false;
35191         void* broadcaster_ptr = untag_ptr(broadcaster);
35192         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35193         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35194         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35195         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35196         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35197         void* logger_ptr = untag_ptr(logger);
35198         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35199         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35200         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35201         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35202         return tag_ptr(ret_conv, true);
35203 }
35204
35205 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
35206         LDKChannelMonitor this_arg_conv;
35207         this_arg_conv.inner = untag_ptr(this_arg);
35208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35210         this_arg_conv.is_owned = false;
35211         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
35212         return ret_conv;
35213 }
35214
35215 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
35216         LDKChannelMonitor this_arg_conv;
35217         this_arg_conv.inner = untag_ptr(this_arg);
35218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35220         this_arg_conv.is_owned = false;
35221         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
35222         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
35223         return tag_ptr(ret_conv, true);
35224 }
35225
35226 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
35227         LDKChannelMonitor this_arg_conv;
35228         this_arg_conv.inner = untag_ptr(this_arg);
35229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35231         this_arg_conv.is_owned = false;
35232         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
35233         uint64_tArray ret_arr = NULL;
35234         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35235         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35236         for (size_t a = 0; a < ret_var.datalen; a++) {
35237                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
35238                 *ret_conv_52_conv = ret_var.data[a];
35239                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
35240         }
35241         
35242         FREE(ret_var.data);
35243         return ret_arr;
35244 }
35245
35246 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter, uint64_t logger) {
35247         LDKChannelMonitor 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         void* filter_ptr = untag_ptr(filter);
35253         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
35254         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
35255         void* logger_ptr = untag_ptr(logger);
35256         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35257         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35258         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
35259 }
35260
35261 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) {
35262         LDKChannelMonitor this_arg_conv;
35263         this_arg_conv.inner = untag_ptr(this_arg);
35264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35266         this_arg_conv.is_owned = false;
35267         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
35268         uint64_tArray ret_arr = NULL;
35269         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35270         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35271         for (size_t o = 0; o < ret_var.datalen; o++) {
35272                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35273                 *ret_conv_14_copy = ret_var.data[o];
35274                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
35275                 ret_arr_ptr[o] = ret_conv_14_ref;
35276         }
35277         
35278         FREE(ret_var.data);
35279         return ret_arr;
35280 }
35281
35282 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
35283         LDKChannelMonitor this_arg_conv;
35284         this_arg_conv.inner = untag_ptr(this_arg);
35285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35287         this_arg_conv.is_owned = false;
35288         void* handler_ptr = untag_ptr(handler);
35289         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
35290         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
35291         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
35292 }
35293
35294 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
35295         LDKChannelMonitor this_arg_conv;
35296         this_arg_conv.inner = untag_ptr(this_arg);
35297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35299         this_arg_conv.is_owned = false;
35300         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
35301         uint64_t ret_ref = 0;
35302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35304         return ret_ref;
35305 }
35306
35307 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) {
35308         LDKChannelMonitor this_arg_conv;
35309         this_arg_conv.inner = untag_ptr(this_arg);
35310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35312         this_arg_conv.is_owned = false;
35313         LDKChannelMonitorUpdate update_conv;
35314         update_conv.inner = untag_ptr(update);
35315         update_conv.is_owned = ptr_is_owned(update);
35316         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
35317         update_conv.is_owned = false;
35318         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
35319         uint64_tArray ret_arr = NULL;
35320         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35321         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35322         for (size_t x = 0; x < ret_var.datalen; x++) {
35323                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
35324                 uint64_t ret_conv_23_ref = 0;
35325                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
35326                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
35327                 ret_arr_ptr[x] = ret_conv_23_ref;
35328         }
35329         
35330         FREE(ret_var.data);
35331         return ret_arr;
35332 }
35333
35334 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) {
35335         LDKChannelMonitor this_arg_conv;
35336         this_arg_conv.inner = untag_ptr(this_arg);
35337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35339         this_arg_conv.is_owned = false;
35340         LDKTransaction justice_tx_ref;
35341         justice_tx_ref.datalen = justice_tx->arr_len;
35342         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
35343         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
35344         justice_tx_ref.data_is_owned = true;
35345         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
35346         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
35347         return tag_ptr(ret_conv, true);
35348 }
35349
35350 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
35351         LDKChannelMonitor this_arg_conv;
35352         this_arg_conv.inner = untag_ptr(this_arg);
35353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35355         this_arg_conv.is_owned = false;
35356         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35357         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
35358         return ret_arr;
35359 }
35360
35361 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) {
35362         LDKChannelMonitor this_arg_conv;
35363         this_arg_conv.inner = untag_ptr(this_arg);
35364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35366         this_arg_conv.is_owned = false;
35367         void* logger_ptr = untag_ptr(logger);
35368         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35369         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35370         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
35371         ptrArray ret_arr = NULL;
35372         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35373         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35374         for (size_t m = 0; m < ret_var.datalen; m++) {
35375                 LDKTransaction ret_conv_12_var = ret_var.data[m];
35376                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
35377                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
35378                 Transaction_free(ret_conv_12_var);
35379                 ret_arr_ptr[m] = ret_conv_12_arr;
35380         }
35381         
35382         FREE(ret_var.data);
35383         return ret_arr;
35384 }
35385
35386 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) {
35387         LDKChannelMonitor this_arg_conv;
35388         this_arg_conv.inner = untag_ptr(this_arg);
35389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35391         this_arg_conv.is_owned = false;
35392         uint8_t header_arr[80];
35393         CHECK(header->arr_len == 80);
35394         memcpy(header_arr, header->elems, 80); FREE(header);
35395         uint8_t (*header_ref)[80] = &header_arr;
35396         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35397         txdata_constr.datalen = txdata->arr_len;
35398         if (txdata_constr.datalen > 0)
35399                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35400         else
35401                 txdata_constr.data = NULL;
35402         uint64_t* txdata_vals = txdata->elems;
35403         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35404                 uint64_t txdata_conv_28 = txdata_vals[c];
35405                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35406                 CHECK_ACCESS(txdata_conv_28_ptr);
35407                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35408                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35409                 txdata_constr.data[c] = txdata_conv_28_conv;
35410         }
35411         FREE(txdata);
35412         void* broadcaster_ptr = untag_ptr(broadcaster);
35413         CHECK_ACCESS(broadcaster_ptr);
35414         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35415         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35417                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35418         }
35419         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35420         CHECK_ACCESS(fee_estimator_ptr);
35421         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35422         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35423                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35424                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35425         }
35426         void* logger_ptr = untag_ptr(logger);
35427         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35428         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35429         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);
35430         uint64_tArray ret_arr = NULL;
35431         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35432         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35433         for (size_t x = 0; x < ret_var.datalen; x++) {
35434                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35435                 *ret_conv_49_conv = ret_var.data[x];
35436                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35437         }
35438         
35439         FREE(ret_var.data);
35440         return ret_arr;
35441 }
35442
35443 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) {
35444         LDKChannelMonitor this_arg_conv;
35445         this_arg_conv.inner = untag_ptr(this_arg);
35446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35448         this_arg_conv.is_owned = false;
35449         uint8_t header_arr[80];
35450         CHECK(header->arr_len == 80);
35451         memcpy(header_arr, header->elems, 80); FREE(header);
35452         uint8_t (*header_ref)[80] = &header_arr;
35453         void* broadcaster_ptr = untag_ptr(broadcaster);
35454         CHECK_ACCESS(broadcaster_ptr);
35455         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35456         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35457                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35458                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35459         }
35460         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35461         CHECK_ACCESS(fee_estimator_ptr);
35462         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35463         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35464                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35465                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35466         }
35467         void* logger_ptr = untag_ptr(logger);
35468         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35469         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35470         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35471 }
35472
35473 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) {
35474         LDKChannelMonitor this_arg_conv;
35475         this_arg_conv.inner = untag_ptr(this_arg);
35476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35478         this_arg_conv.is_owned = false;
35479         uint8_t header_arr[80];
35480         CHECK(header->arr_len == 80);
35481         memcpy(header_arr, header->elems, 80); FREE(header);
35482         uint8_t (*header_ref)[80] = &header_arr;
35483         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35484         txdata_constr.datalen = txdata->arr_len;
35485         if (txdata_constr.datalen > 0)
35486                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35487         else
35488                 txdata_constr.data = NULL;
35489         uint64_t* txdata_vals = txdata->elems;
35490         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35491                 uint64_t txdata_conv_28 = txdata_vals[c];
35492                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35493                 CHECK_ACCESS(txdata_conv_28_ptr);
35494                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35495                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35496                 txdata_constr.data[c] = txdata_conv_28_conv;
35497         }
35498         FREE(txdata);
35499         void* broadcaster_ptr = untag_ptr(broadcaster);
35500         CHECK_ACCESS(broadcaster_ptr);
35501         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35502         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35503                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35504                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35505         }
35506         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35507         CHECK_ACCESS(fee_estimator_ptr);
35508         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35509         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35510                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35511                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35512         }
35513         void* logger_ptr = untag_ptr(logger);
35514         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35515         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35516         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);
35517         uint64_tArray ret_arr = NULL;
35518         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35519         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35520         for (size_t x = 0; x < ret_var.datalen; x++) {
35521                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35522                 *ret_conv_49_conv = ret_var.data[x];
35523                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35524         }
35525         
35526         FREE(ret_var.data);
35527         return ret_arr;
35528 }
35529
35530 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) {
35531         LDKChannelMonitor this_arg_conv;
35532         this_arg_conv.inner = untag_ptr(this_arg);
35533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35535         this_arg_conv.is_owned = false;
35536         uint8_t txid_arr[32];
35537         CHECK(txid->arr_len == 32);
35538         memcpy(txid_arr, txid->elems, 32); FREE(txid);
35539         uint8_t (*txid_ref)[32] = &txid_arr;
35540         void* broadcaster_ptr = untag_ptr(broadcaster);
35541         CHECK_ACCESS(broadcaster_ptr);
35542         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35543         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35544                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35545                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35546         }
35547         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35548         CHECK_ACCESS(fee_estimator_ptr);
35549         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35550         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35551                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35552                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35553         }
35554         void* logger_ptr = untag_ptr(logger);
35555         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35556         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35557         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
35558 }
35559
35560 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) {
35561         LDKChannelMonitor this_arg_conv;
35562         this_arg_conv.inner = untag_ptr(this_arg);
35563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35565         this_arg_conv.is_owned = false;
35566         uint8_t header_arr[80];
35567         CHECK(header->arr_len == 80);
35568         memcpy(header_arr, header->elems, 80); FREE(header);
35569         uint8_t (*header_ref)[80] = &header_arr;
35570         void* broadcaster_ptr = untag_ptr(broadcaster);
35571         CHECK_ACCESS(broadcaster_ptr);
35572         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35573         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35574                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35575                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35576         }
35577         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35578         CHECK_ACCESS(fee_estimator_ptr);
35579         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35580         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35581                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35582                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35583         }
35584         void* logger_ptr = untag_ptr(logger);
35585         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35586         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35587         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35588         uint64_tArray ret_arr = NULL;
35589         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35590         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35591         for (size_t x = 0; x < ret_var.datalen; x++) {
35592                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35593                 *ret_conv_49_conv = ret_var.data[x];
35594                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35595         }
35596         
35597         FREE(ret_var.data);
35598         return ret_arr;
35599 }
35600
35601 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
35602         LDKChannelMonitor this_arg_conv;
35603         this_arg_conv.inner = untag_ptr(this_arg);
35604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35606         this_arg_conv.is_owned = false;
35607         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
35608         uint64_tArray ret_arr = NULL;
35609         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35610         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35611         for (size_t c = 0; c < ret_var.datalen; c++) {
35612                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
35613                 *ret_conv_54_conv = ret_var.data[c];
35614                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
35615         }
35616         
35617         FREE(ret_var.data);
35618         return ret_arr;
35619 }
35620
35621 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
35622         LDKChannelMonitor this_arg_conv;
35623         this_arg_conv.inner = untag_ptr(this_arg);
35624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35626         this_arg_conv.is_owned = false;
35627         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
35628         uint64_t ret_ref = 0;
35629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35631         return ret_ref;
35632 }
35633
35634 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) {
35635         LDKChannelMonitor this_arg_conv;
35636         this_arg_conv.inner = untag_ptr(this_arg);
35637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35639         this_arg_conv.is_owned = false;
35640         void* broadcaster_ptr = untag_ptr(broadcaster);
35641         CHECK_ACCESS(broadcaster_ptr);
35642         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35643         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35644                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35645                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35646         }
35647         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35648         CHECK_ACCESS(fee_estimator_ptr);
35649         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35650         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35652                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35653         }
35654         void* logger_ptr = untag_ptr(logger);
35655         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35656         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35657         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35658 }
35659
35660 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) {
35661         LDKChannelMonitor this_arg_conv;
35662         this_arg_conv.inner = untag_ptr(this_arg);
35663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35665         this_arg_conv.is_owned = false;
35666         LDKTransaction tx_ref;
35667         tx_ref.datalen = tx->arr_len;
35668         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
35669         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
35670         tx_ref.data_is_owned = true;
35671         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
35672         uint64_tArray ret_arr = NULL;
35673         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35674         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35675         for (size_t b = 0; b < ret_var.datalen; b++) {
35676                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
35677                 *ret_conv_27_copy = ret_var.data[b];
35678                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
35679                 ret_arr_ptr[b] = ret_conv_27_ref;
35680         }
35681         
35682         FREE(ret_var.data);
35683         return ret_arr;
35684 }
35685
35686 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
35687         LDKChannelMonitor this_arg_conv;
35688         this_arg_conv.inner = untag_ptr(this_arg);
35689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35691         this_arg_conv.is_owned = false;
35692         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
35693         uint64_tArray ret_arr = NULL;
35694         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35695         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35696         for (size_t j = 0; j < ret_var.datalen; j++) {
35697                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35698                 *ret_conv_9_copy = ret_var.data[j];
35699                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
35700                 ret_arr_ptr[j] = ret_conv_9_ref;
35701         }
35702         
35703         FREE(ret_var.data);
35704         return ret_arr;
35705 }
35706
35707 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
35708         LDKu8slice ser_ref;
35709         ser_ref.datalen = ser->arr_len;
35710         ser_ref.data = ser->elems;
35711         void* arg_a_ptr = untag_ptr(arg_a);
35712         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
35713         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
35714         void* arg_b_ptr = untag_ptr(arg_b);
35715         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
35716         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
35717         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
35718         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
35719         FREE(ser);
35720         return tag_ptr(ret_conv, true);
35721 }
35722
35723 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
35724         LDKOutPoint this_obj_conv;
35725         this_obj_conv.inner = untag_ptr(this_obj);
35726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35728         OutPoint_free(this_obj_conv);
35729 }
35730
35731 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
35732         LDKOutPoint this_ptr_conv;
35733         this_ptr_conv.inner = untag_ptr(this_ptr);
35734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35736         this_ptr_conv.is_owned = false;
35737         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35738         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
35739         return ret_arr;
35740 }
35741
35742 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
35743         LDKOutPoint this_ptr_conv;
35744         this_ptr_conv.inner = untag_ptr(this_ptr);
35745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35747         this_ptr_conv.is_owned = false;
35748         LDKThirtyTwoBytes val_ref;
35749         CHECK(val->arr_len == 32);
35750         memcpy(val_ref.data, val->elems, 32); FREE(val);
35751         OutPoint_set_txid(&this_ptr_conv, val_ref);
35752 }
35753
35754 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
35755         LDKOutPoint this_ptr_conv;
35756         this_ptr_conv.inner = untag_ptr(this_ptr);
35757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35759         this_ptr_conv.is_owned = false;
35760         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
35761         return ret_conv;
35762 }
35763
35764 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
35765         LDKOutPoint this_ptr_conv;
35766         this_ptr_conv.inner = untag_ptr(this_ptr);
35767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35769         this_ptr_conv.is_owned = false;
35770         OutPoint_set_index(&this_ptr_conv, val);
35771 }
35772
35773 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
35774         LDKThirtyTwoBytes txid_arg_ref;
35775         CHECK(txid_arg->arr_len == 32);
35776         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35777         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
35778         uint64_t ret_ref = 0;
35779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35781         return ret_ref;
35782 }
35783
35784 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
35785         LDKOutPoint ret_var = OutPoint_clone(arg);
35786         uint64_t ret_ref = 0;
35787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35789         return ret_ref;
35790 }
35791 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
35792         LDKOutPoint arg_conv;
35793         arg_conv.inner = untag_ptr(arg);
35794         arg_conv.is_owned = ptr_is_owned(arg);
35795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35796         arg_conv.is_owned = false;
35797         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
35798         return ret_conv;
35799 }
35800
35801 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
35802         LDKOutPoint orig_conv;
35803         orig_conv.inner = untag_ptr(orig);
35804         orig_conv.is_owned = ptr_is_owned(orig);
35805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35806         orig_conv.is_owned = false;
35807         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
35808         uint64_t ret_ref = 0;
35809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35811         return ret_ref;
35812 }
35813
35814 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
35815         LDKOutPoint a_conv;
35816         a_conv.inner = untag_ptr(a);
35817         a_conv.is_owned = ptr_is_owned(a);
35818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35819         a_conv.is_owned = false;
35820         LDKOutPoint b_conv;
35821         b_conv.inner = untag_ptr(b);
35822         b_conv.is_owned = ptr_is_owned(b);
35823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35824         b_conv.is_owned = false;
35825         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
35826         return ret_conv;
35827 }
35828
35829 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
35830         LDKOutPoint o_conv;
35831         o_conv.inner = untag_ptr(o);
35832         o_conv.is_owned = ptr_is_owned(o);
35833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35834         o_conv.is_owned = false;
35835         int64_t ret_conv = OutPoint_hash(&o_conv);
35836         return ret_conv;
35837 }
35838
35839 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
35840         LDKOutPoint this_arg_conv;
35841         this_arg_conv.inner = untag_ptr(this_arg);
35842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35844         this_arg_conv.is_owned = false;
35845         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35846         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
35847         return ret_arr;
35848 }
35849
35850 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
35851         LDKOutPoint obj_conv;
35852         obj_conv.inner = untag_ptr(obj);
35853         obj_conv.is_owned = ptr_is_owned(obj);
35854         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35855         obj_conv.is_owned = false;
35856         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
35857         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35858         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35859         CVec_u8Z_free(ret_var);
35860         return ret_arr;
35861 }
35862
35863 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
35864         LDKu8slice ser_ref;
35865         ser_ref.datalen = ser->arr_len;
35866         ser_ref.data = ser->elems;
35867         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35868         *ret_conv = OutPoint_read(ser_ref);
35869         FREE(ser);
35870         return tag_ptr(ret_conv, true);
35871 }
35872
35873 void  __attribute__((export_name("TS_InboundHTLCErr_free"))) TS_InboundHTLCErr_free(uint64_t this_obj) {
35874         LDKInboundHTLCErr this_obj_conv;
35875         this_obj_conv.inner = untag_ptr(this_obj);
35876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35878         InboundHTLCErr_free(this_obj_conv);
35879 }
35880
35881 int16_t  __attribute__((export_name("TS_InboundHTLCErr_get_err_code"))) TS_InboundHTLCErr_get_err_code(uint64_t this_ptr) {
35882         LDKInboundHTLCErr this_ptr_conv;
35883         this_ptr_conv.inner = untag_ptr(this_ptr);
35884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35886         this_ptr_conv.is_owned = false;
35887         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
35888         return ret_conv;
35889 }
35890
35891 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_code"))) TS_InboundHTLCErr_set_err_code(uint64_t this_ptr, int16_t val) {
35892         LDKInboundHTLCErr this_ptr_conv;
35893         this_ptr_conv.inner = untag_ptr(this_ptr);
35894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35896         this_ptr_conv.is_owned = false;
35897         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
35898 }
35899
35900 int8_tArray  __attribute__((export_name("TS_InboundHTLCErr_get_err_data"))) TS_InboundHTLCErr_get_err_data(uint64_t this_ptr) {
35901         LDKInboundHTLCErr this_ptr_conv;
35902         this_ptr_conv.inner = untag_ptr(this_ptr);
35903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35905         this_ptr_conv.is_owned = false;
35906         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
35907         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35908         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35909         CVec_u8Z_free(ret_var);
35910         return ret_arr;
35911 }
35912
35913 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_data"))) TS_InboundHTLCErr_set_err_data(uint64_t this_ptr, int8_tArray val) {
35914         LDKInboundHTLCErr this_ptr_conv;
35915         this_ptr_conv.inner = untag_ptr(this_ptr);
35916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35918         this_ptr_conv.is_owned = false;
35919         LDKCVec_u8Z val_ref;
35920         val_ref.datalen = val->arr_len;
35921         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
35922         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35923         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
35924 }
35925
35926 jstring  __attribute__((export_name("TS_InboundHTLCErr_get_msg"))) TS_InboundHTLCErr_get_msg(uint64_t this_ptr) {
35927         LDKInboundHTLCErr this_ptr_conv;
35928         this_ptr_conv.inner = untag_ptr(this_ptr);
35929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35931         this_ptr_conv.is_owned = false;
35932         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
35933         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35934         Str_free(ret_str);
35935         return ret_conv;
35936 }
35937
35938 void  __attribute__((export_name("TS_InboundHTLCErr_set_msg"))) TS_InboundHTLCErr_set_msg(uint64_t this_ptr, jstring val) {
35939         LDKInboundHTLCErr this_ptr_conv;
35940         this_ptr_conv.inner = untag_ptr(this_ptr);
35941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35943         this_ptr_conv.is_owned = false;
35944         LDKStr val_conv = str_ref_to_owned_c(val);
35945         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
35946 }
35947
35948 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_new"))) TS_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
35949         LDKCVec_u8Z err_data_arg_ref;
35950         err_data_arg_ref.datalen = err_data_arg->arr_len;
35951         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35952         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
35953         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
35954         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
35955         uint64_t ret_ref = 0;
35956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35958         return ret_ref;
35959 }
35960
35961 uint64_t  __attribute__((export_name("TS_peel_payment_onion"))) TS_peel_payment_onion(uint64_t msg, uint64_t node_signer, uint64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
35962         LDKUpdateAddHTLC msg_conv;
35963         msg_conv.inner = untag_ptr(msg);
35964         msg_conv.is_owned = ptr_is_owned(msg);
35965         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35966         msg_conv.is_owned = false;
35967         void* node_signer_ptr = untag_ptr(node_signer);
35968         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
35969         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
35970         void* logger_ptr = untag_ptr(logger);
35971         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35972         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35973         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
35974         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
35975         return tag_ptr(ret_conv, true);
35976 }
35977
35978 void  __attribute__((export_name("TS_PendingHTLCRouting_free"))) TS_PendingHTLCRouting_free(uint64_t this_ptr) {
35979         if (!ptr_is_owned(this_ptr)) return;
35980         void* this_ptr_ptr = untag_ptr(this_ptr);
35981         CHECK_ACCESS(this_ptr_ptr);
35982         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
35983         FREE(untag_ptr(this_ptr));
35984         PendingHTLCRouting_free(this_ptr_conv);
35985 }
35986
35987 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
35988         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
35989         *ret_copy = PendingHTLCRouting_clone(arg);
35990         uint64_t ret_ref = tag_ptr(ret_copy, true);
35991         return ret_ref;
35992 }
35993 int64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone_ptr"))) TS_PendingHTLCRouting_clone_ptr(uint64_t arg) {
35994         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
35995         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
35996         return ret_conv;
35997 }
35998
35999 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone"))) TS_PendingHTLCRouting_clone(uint64_t orig) {
36000         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
36001         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36002         *ret_copy = PendingHTLCRouting_clone(orig_conv);
36003         uint64_t ret_ref = tag_ptr(ret_copy, true);
36004         return ret_ref;
36005 }
36006
36007 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_forward"))) TS_PendingHTLCRouting_forward(uint64_t onion_packet, int64_t short_channel_id, uint64_t blinded) {
36008         LDKOnionPacket onion_packet_conv;
36009         onion_packet_conv.inner = untag_ptr(onion_packet);
36010         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
36011         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
36012         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
36013         LDKBlindedForward blinded_conv;
36014         blinded_conv.inner = untag_ptr(blinded);
36015         blinded_conv.is_owned = ptr_is_owned(blinded);
36016         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
36017         blinded_conv = BlindedForward_clone(&blinded_conv);
36018         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36019         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
36020         uint64_t ret_ref = tag_ptr(ret_copy, true);
36021         return ret_ref;
36022 }
36023
36024 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_receive"))) TS_PendingHTLCRouting_receive(uint64_t payment_data, uint64_t payment_metadata, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, uint64_tArray custom_tlvs, jboolean requires_blinded_error) {
36025         LDKFinalOnionHopData payment_data_conv;
36026         payment_data_conv.inner = untag_ptr(payment_data);
36027         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36028         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36029         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36030         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36031         CHECK_ACCESS(payment_metadata_ptr);
36032         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36033         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36034         LDKThirtyTwoBytes phantom_shared_secret_ref;
36035         CHECK(phantom_shared_secret->arr_len == 32);
36036         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
36037         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36038         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36039         if (custom_tlvs_constr.datalen > 0)
36040                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36041         else
36042                 custom_tlvs_constr.data = NULL;
36043         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
36044         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36045                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36046                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36047                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36048                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36049                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36050                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36051         }
36052         FREE(custom_tlvs);
36053         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36054         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
36055         uint64_t ret_ref = tag_ptr(ret_copy, true);
36056         return ret_ref;
36057 }
36058
36059 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_receive_keysend"))) TS_PendingHTLCRouting_receive_keysend(uint64_t payment_data, int8_tArray payment_preimage, uint64_t payment_metadata, int32_t incoming_cltv_expiry, uint64_tArray custom_tlvs) {
36060         LDKFinalOnionHopData payment_data_conv;
36061         payment_data_conv.inner = untag_ptr(payment_data);
36062         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36063         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36064         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36065         LDKThirtyTwoBytes payment_preimage_ref;
36066         CHECK(payment_preimage->arr_len == 32);
36067         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
36068         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36069         CHECK_ACCESS(payment_metadata_ptr);
36070         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36071         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36072         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36073         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36074         if (custom_tlvs_constr.datalen > 0)
36075                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36076         else
36077                 custom_tlvs_constr.data = NULL;
36078         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
36079         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36080                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36081                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36082                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36083                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36084                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36085                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36086         }
36087         FREE(custom_tlvs);
36088         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36089         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr);
36090         uint64_t ret_ref = tag_ptr(ret_copy, true);
36091         return ret_ref;
36092 }
36093
36094 void  __attribute__((export_name("TS_BlindedForward_free"))) TS_BlindedForward_free(uint64_t this_obj) {
36095         LDKBlindedForward this_obj_conv;
36096         this_obj_conv.inner = untag_ptr(this_obj);
36097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36099         BlindedForward_free(this_obj_conv);
36100 }
36101
36102 int8_tArray  __attribute__((export_name("TS_BlindedForward_get_inbound_blinding_point"))) TS_BlindedForward_get_inbound_blinding_point(uint64_t this_ptr) {
36103         LDKBlindedForward this_ptr_conv;
36104         this_ptr_conv.inner = untag_ptr(this_ptr);
36105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36107         this_ptr_conv.is_owned = false;
36108         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36109         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
36110         return ret_arr;
36111 }
36112
36113 void  __attribute__((export_name("TS_BlindedForward_set_inbound_blinding_point"))) TS_BlindedForward_set_inbound_blinding_point(uint64_t this_ptr, int8_tArray val) {
36114         LDKBlindedForward this_ptr_conv;
36115         this_ptr_conv.inner = untag_ptr(this_ptr);
36116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36118         this_ptr_conv.is_owned = false;
36119         LDKPublicKey val_ref;
36120         CHECK(val->arr_len == 33);
36121         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36122         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
36123 }
36124
36125 uint32_t  __attribute__((export_name("TS_BlindedForward_get_failure"))) TS_BlindedForward_get_failure(uint64_t this_ptr) {
36126         LDKBlindedForward this_ptr_conv;
36127         this_ptr_conv.inner = untag_ptr(this_ptr);
36128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36130         this_ptr_conv.is_owned = false;
36131         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedForward_get_failure(&this_ptr_conv));
36132         return ret_conv;
36133 }
36134
36135 void  __attribute__((export_name("TS_BlindedForward_set_failure"))) TS_BlindedForward_set_failure(uint64_t this_ptr, uint32_t val) {
36136         LDKBlindedForward this_ptr_conv;
36137         this_ptr_conv.inner = untag_ptr(this_ptr);
36138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36140         this_ptr_conv.is_owned = false;
36141         LDKBlindedFailure val_conv = LDKBlindedFailure_from_js(val);
36142         BlindedForward_set_failure(&this_ptr_conv, val_conv);
36143 }
36144
36145 uint64_t  __attribute__((export_name("TS_BlindedForward_new"))) TS_BlindedForward_new(int8_tArray inbound_blinding_point_arg, uint32_t failure_arg) {
36146         LDKPublicKey inbound_blinding_point_arg_ref;
36147         CHECK(inbound_blinding_point_arg->arr_len == 33);
36148         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
36149         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_js(failure_arg);
36150         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
36151         uint64_t ret_ref = 0;
36152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36154         return ret_ref;
36155 }
36156
36157 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
36158         LDKBlindedForward ret_var = BlindedForward_clone(arg);
36159         uint64_t ret_ref = 0;
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36162         return ret_ref;
36163 }
36164 int64_t  __attribute__((export_name("TS_BlindedForward_clone_ptr"))) TS_BlindedForward_clone_ptr(uint64_t arg) {
36165         LDKBlindedForward arg_conv;
36166         arg_conv.inner = untag_ptr(arg);
36167         arg_conv.is_owned = ptr_is_owned(arg);
36168         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36169         arg_conv.is_owned = false;
36170         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
36171         return ret_conv;
36172 }
36173
36174 uint64_t  __attribute__((export_name("TS_BlindedForward_clone"))) TS_BlindedForward_clone(uint64_t orig) {
36175         LDKBlindedForward orig_conv;
36176         orig_conv.inner = untag_ptr(orig);
36177         orig_conv.is_owned = ptr_is_owned(orig);
36178         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36179         orig_conv.is_owned = false;
36180         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
36181         uint64_t ret_ref = 0;
36182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36184         return ret_ref;
36185 }
36186
36187 int64_t  __attribute__((export_name("TS_BlindedForward_hash"))) TS_BlindedForward_hash(uint64_t o) {
36188         LDKBlindedForward o_conv;
36189         o_conv.inner = untag_ptr(o);
36190         o_conv.is_owned = ptr_is_owned(o);
36191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36192         o_conv.is_owned = false;
36193         int64_t ret_conv = BlindedForward_hash(&o_conv);
36194         return ret_conv;
36195 }
36196
36197 jboolean  __attribute__((export_name("TS_BlindedForward_eq"))) TS_BlindedForward_eq(uint64_t a, uint64_t b) {
36198         LDKBlindedForward a_conv;
36199         a_conv.inner = untag_ptr(a);
36200         a_conv.is_owned = ptr_is_owned(a);
36201         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36202         a_conv.is_owned = false;
36203         LDKBlindedForward b_conv;
36204         b_conv.inner = untag_ptr(b);
36205         b_conv.is_owned = ptr_is_owned(b);
36206         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36207         b_conv.is_owned = false;
36208         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
36209         return ret_conv;
36210 }
36211
36212 void  __attribute__((export_name("TS_PendingHTLCInfo_free"))) TS_PendingHTLCInfo_free(uint64_t this_obj) {
36213         LDKPendingHTLCInfo this_obj_conv;
36214         this_obj_conv.inner = untag_ptr(this_obj);
36215         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36217         PendingHTLCInfo_free(this_obj_conv);
36218 }
36219
36220 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_routing"))) TS_PendingHTLCInfo_get_routing(uint64_t this_ptr) {
36221         LDKPendingHTLCInfo this_ptr_conv;
36222         this_ptr_conv.inner = untag_ptr(this_ptr);
36223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36225         this_ptr_conv.is_owned = false;
36226         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36227         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
36228         uint64_t ret_ref = tag_ptr(ret_copy, true);
36229         return ret_ref;
36230 }
36231
36232 void  __attribute__((export_name("TS_PendingHTLCInfo_set_routing"))) TS_PendingHTLCInfo_set_routing(uint64_t this_ptr, uint64_t val) {
36233         LDKPendingHTLCInfo this_ptr_conv;
36234         this_ptr_conv.inner = untag_ptr(this_ptr);
36235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36237         this_ptr_conv.is_owned = false;
36238         void* val_ptr = untag_ptr(val);
36239         CHECK_ACCESS(val_ptr);
36240         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
36241         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
36242         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
36243 }
36244
36245 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_shared_secret"))) TS_PendingHTLCInfo_get_incoming_shared_secret(uint64_t this_ptr) {
36246         LDKPendingHTLCInfo this_ptr_conv;
36247         this_ptr_conv.inner = untag_ptr(this_ptr);
36248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36250         this_ptr_conv.is_owned = false;
36251         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36252         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
36253         return ret_arr;
36254 }
36255
36256 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_shared_secret"))) TS_PendingHTLCInfo_set_incoming_shared_secret(uint64_t this_ptr, int8_tArray val) {
36257         LDKPendingHTLCInfo this_ptr_conv;
36258         this_ptr_conv.inner = untag_ptr(this_ptr);
36259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36261         this_ptr_conv.is_owned = false;
36262         LDKThirtyTwoBytes val_ref;
36263         CHECK(val->arr_len == 32);
36264         memcpy(val_ref.data, val->elems, 32); FREE(val);
36265         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
36266 }
36267
36268 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_payment_hash"))) TS_PendingHTLCInfo_get_payment_hash(uint64_t this_ptr) {
36269         LDKPendingHTLCInfo this_ptr_conv;
36270         this_ptr_conv.inner = untag_ptr(this_ptr);
36271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36273         this_ptr_conv.is_owned = false;
36274         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36275         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
36276         return ret_arr;
36277 }
36278
36279 void  __attribute__((export_name("TS_PendingHTLCInfo_set_payment_hash"))) TS_PendingHTLCInfo_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
36280         LDKPendingHTLCInfo this_ptr_conv;
36281         this_ptr_conv.inner = untag_ptr(this_ptr);
36282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36284         this_ptr_conv.is_owned = false;
36285         LDKThirtyTwoBytes val_ref;
36286         CHECK(val->arr_len == 32);
36287         memcpy(val_ref.data, val->elems, 32); FREE(val);
36288         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
36289 }
36290
36291 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_amt_msat"))) TS_PendingHTLCInfo_get_incoming_amt_msat(uint64_t this_ptr) {
36292         LDKPendingHTLCInfo this_ptr_conv;
36293         this_ptr_conv.inner = untag_ptr(this_ptr);
36294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36296         this_ptr_conv.is_owned = false;
36297         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36298         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
36299         uint64_t ret_ref = tag_ptr(ret_copy, true);
36300         return ret_ref;
36301 }
36302
36303 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_amt_msat"))) TS_PendingHTLCInfo_set_incoming_amt_msat(uint64_t this_ptr, uint64_t val) {
36304         LDKPendingHTLCInfo this_ptr_conv;
36305         this_ptr_conv.inner = untag_ptr(this_ptr);
36306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36308         this_ptr_conv.is_owned = false;
36309         void* val_ptr = untag_ptr(val);
36310         CHECK_ACCESS(val_ptr);
36311         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36312         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36313         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
36314 }
36315
36316 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_amt_msat"))) TS_PendingHTLCInfo_get_outgoing_amt_msat(uint64_t this_ptr) {
36317         LDKPendingHTLCInfo this_ptr_conv;
36318         this_ptr_conv.inner = untag_ptr(this_ptr);
36319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36321         this_ptr_conv.is_owned = false;
36322         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
36323         return ret_conv;
36324 }
36325
36326 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_amt_msat"))) TS_PendingHTLCInfo_set_outgoing_amt_msat(uint64_t this_ptr, int64_t val) {
36327         LDKPendingHTLCInfo this_ptr_conv;
36328         this_ptr_conv.inner = untag_ptr(this_ptr);
36329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36331         this_ptr_conv.is_owned = false;
36332         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
36333 }
36334
36335 int32_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_cltv_value"))) TS_PendingHTLCInfo_get_outgoing_cltv_value(uint64_t this_ptr) {
36336         LDKPendingHTLCInfo this_ptr_conv;
36337         this_ptr_conv.inner = untag_ptr(this_ptr);
36338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36340         this_ptr_conv.is_owned = false;
36341         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
36342         return ret_conv;
36343 }
36344
36345 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_cltv_value"))) TS_PendingHTLCInfo_set_outgoing_cltv_value(uint64_t this_ptr, int32_t val) {
36346         LDKPendingHTLCInfo this_ptr_conv;
36347         this_ptr_conv.inner = untag_ptr(this_ptr);
36348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36350         this_ptr_conv.is_owned = false;
36351         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
36352 }
36353
36354 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_skimmed_fee_msat"))) TS_PendingHTLCInfo_get_skimmed_fee_msat(uint64_t this_ptr) {
36355         LDKPendingHTLCInfo this_ptr_conv;
36356         this_ptr_conv.inner = untag_ptr(this_ptr);
36357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36359         this_ptr_conv.is_owned = false;
36360         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36361         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
36362         uint64_t ret_ref = tag_ptr(ret_copy, true);
36363         return ret_ref;
36364 }
36365
36366 void  __attribute__((export_name("TS_PendingHTLCInfo_set_skimmed_fee_msat"))) TS_PendingHTLCInfo_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
36367         LDKPendingHTLCInfo this_ptr_conv;
36368         this_ptr_conv.inner = untag_ptr(this_ptr);
36369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36371         this_ptr_conv.is_owned = false;
36372         void* val_ptr = untag_ptr(val);
36373         CHECK_ACCESS(val_ptr);
36374         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36375         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36376         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
36377 }
36378
36379 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_new"))) TS_PendingHTLCInfo_new(uint64_t routing_arg, int8_tArray incoming_shared_secret_arg, int8_tArray payment_hash_arg, uint64_t incoming_amt_msat_arg, int64_t outgoing_amt_msat_arg, int32_t outgoing_cltv_value_arg, uint64_t skimmed_fee_msat_arg) {
36380         void* routing_arg_ptr = untag_ptr(routing_arg);
36381         CHECK_ACCESS(routing_arg_ptr);
36382         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
36383         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
36384         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
36385         CHECK(incoming_shared_secret_arg->arr_len == 32);
36386         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
36387         LDKThirtyTwoBytes payment_hash_arg_ref;
36388         CHECK(payment_hash_arg->arr_len == 32);
36389         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
36390         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
36391         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
36392         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
36393         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
36394         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
36395         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
36396         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
36397         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
36398         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_new(routing_arg_conv, incoming_shared_secret_arg_ref, payment_hash_arg_ref, incoming_amt_msat_arg_conv, outgoing_amt_msat_arg, outgoing_cltv_value_arg, skimmed_fee_msat_arg_conv);
36399         uint64_t ret_ref = 0;
36400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36402         return ret_ref;
36403 }
36404
36405 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
36406         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
36407         uint64_t ret_ref = 0;
36408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36410         return ret_ref;
36411 }
36412 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone_ptr"))) TS_PendingHTLCInfo_clone_ptr(uint64_t arg) {
36413         LDKPendingHTLCInfo arg_conv;
36414         arg_conv.inner = untag_ptr(arg);
36415         arg_conv.is_owned = ptr_is_owned(arg);
36416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36417         arg_conv.is_owned = false;
36418         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
36419         return ret_conv;
36420 }
36421
36422 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone"))) TS_PendingHTLCInfo_clone(uint64_t orig) {
36423         LDKPendingHTLCInfo orig_conv;
36424         orig_conv.inner = untag_ptr(orig);
36425         orig_conv.is_owned = ptr_is_owned(orig);
36426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36427         orig_conv.is_owned = false;
36428         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
36429         uint64_t ret_ref = 0;
36430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36432         return ret_ref;
36433 }
36434
36435 uint32_t  __attribute__((export_name("TS_BlindedFailure_clone"))) TS_BlindedFailure_clone(uint64_t orig) {
36436         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
36437         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_clone(orig_conv));
36438         return ret_conv;
36439 }
36440
36441 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_introduction_node"))) TS_BlindedFailure_from_introduction_node() {
36442         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_introduction_node());
36443         return ret_conv;
36444 }
36445
36446 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_blinded_node"))) TS_BlindedFailure_from_blinded_node() {
36447         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_blinded_node());
36448         return ret_conv;
36449 }
36450
36451 int64_t  __attribute__((export_name("TS_BlindedFailure_hash"))) TS_BlindedFailure_hash(uint64_t o) {
36452         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
36453         int64_t ret_conv = BlindedFailure_hash(o_conv);
36454         return ret_conv;
36455 }
36456
36457 jboolean  __attribute__((export_name("TS_BlindedFailure_eq"))) TS_BlindedFailure_eq(uint64_t a, uint64_t b) {
36458         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
36459         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
36460         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
36461         return ret_conv;
36462 }
36463
36464 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
36465         if (!ptr_is_owned(this_ptr)) return;
36466         void* this_ptr_ptr = untag_ptr(this_ptr);
36467         CHECK_ACCESS(this_ptr_ptr);
36468         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
36469         FREE(untag_ptr(this_ptr));
36470         FailureCode_free(this_ptr_conv);
36471 }
36472
36473 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
36474         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36475         *ret_copy = FailureCode_clone(arg);
36476         uint64_t ret_ref = tag_ptr(ret_copy, true);
36477         return ret_ref;
36478 }
36479 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
36480         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
36481         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
36482         return ret_conv;
36483 }
36484
36485 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
36486         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
36487         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36488         *ret_copy = FailureCode_clone(orig_conv);
36489         uint64_t ret_ref = tag_ptr(ret_copy, true);
36490         return ret_ref;
36491 }
36492
36493 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
36494         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36495         *ret_copy = FailureCode_temporary_node_failure();
36496         uint64_t ret_ref = tag_ptr(ret_copy, true);
36497         return ret_ref;
36498 }
36499
36500 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
36501         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36502         *ret_copy = FailureCode_required_node_feature_missing();
36503         uint64_t ret_ref = tag_ptr(ret_copy, true);
36504         return ret_ref;
36505 }
36506
36507 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
36508         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36509         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
36510         uint64_t ret_ref = tag_ptr(ret_copy, true);
36511         return ret_ref;
36512 }
36513
36514 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
36515         void* a_ptr = untag_ptr(a);
36516         CHECK_ACCESS(a_ptr);
36517         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
36518         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
36519         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36520         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
36521         uint64_t ret_ref = tag_ptr(ret_copy, true);
36522         return ret_ref;
36523 }
36524
36525 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
36526         LDKChannelManager this_obj_conv;
36527         this_obj_conv.inner = untag_ptr(this_obj);
36528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36530         ChannelManager_free(this_obj_conv);
36531 }
36532
36533 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
36534         LDKChainParameters this_obj_conv;
36535         this_obj_conv.inner = untag_ptr(this_obj);
36536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36538         ChainParameters_free(this_obj_conv);
36539 }
36540
36541 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
36542         LDKChainParameters this_ptr_conv;
36543         this_ptr_conv.inner = untag_ptr(this_ptr);
36544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36546         this_ptr_conv.is_owned = false;
36547         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
36548         return ret_conv;
36549 }
36550
36551 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
36552         LDKChainParameters this_ptr_conv;
36553         this_ptr_conv.inner = untag_ptr(this_ptr);
36554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36556         this_ptr_conv.is_owned = false;
36557         LDKNetwork val_conv = LDKNetwork_from_js(val);
36558         ChainParameters_set_network(&this_ptr_conv, val_conv);
36559 }
36560
36561 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
36562         LDKChainParameters this_ptr_conv;
36563         this_ptr_conv.inner = untag_ptr(this_ptr);
36564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36566         this_ptr_conv.is_owned = false;
36567         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
36568         uint64_t ret_ref = 0;
36569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36571         return ret_ref;
36572 }
36573
36574 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
36575         LDKChainParameters this_ptr_conv;
36576         this_ptr_conv.inner = untag_ptr(this_ptr);
36577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36579         this_ptr_conv.is_owned = false;
36580         LDKBestBlock val_conv;
36581         val_conv.inner = untag_ptr(val);
36582         val_conv.is_owned = ptr_is_owned(val);
36583         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36584         val_conv = BestBlock_clone(&val_conv);
36585         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
36586 }
36587
36588 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
36589         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
36590         LDKBestBlock best_block_arg_conv;
36591         best_block_arg_conv.inner = untag_ptr(best_block_arg);
36592         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
36593         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
36594         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
36595         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
36596         uint64_t ret_ref = 0;
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36599         return ret_ref;
36600 }
36601
36602 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
36603         LDKChainParameters ret_var = ChainParameters_clone(arg);
36604         uint64_t ret_ref = 0;
36605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36607         return ret_ref;
36608 }
36609 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
36610         LDKChainParameters arg_conv;
36611         arg_conv.inner = untag_ptr(arg);
36612         arg_conv.is_owned = ptr_is_owned(arg);
36613         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36614         arg_conv.is_owned = false;
36615         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
36616         return ret_conv;
36617 }
36618
36619 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
36620         LDKChainParameters orig_conv;
36621         orig_conv.inner = untag_ptr(orig);
36622         orig_conv.is_owned = ptr_is_owned(orig);
36623         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36624         orig_conv.is_owned = false;
36625         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
36626         uint64_t ret_ref = 0;
36627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36629         return ret_ref;
36630 }
36631
36632 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
36633         LDKCounterpartyForwardingInfo this_obj_conv;
36634         this_obj_conv.inner = untag_ptr(this_obj);
36635         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36637         CounterpartyForwardingInfo_free(this_obj_conv);
36638 }
36639
36640 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
36641         LDKCounterpartyForwardingInfo this_ptr_conv;
36642         this_ptr_conv.inner = untag_ptr(this_ptr);
36643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36645         this_ptr_conv.is_owned = false;
36646         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
36647         return ret_conv;
36648 }
36649
36650 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
36651         LDKCounterpartyForwardingInfo this_ptr_conv;
36652         this_ptr_conv.inner = untag_ptr(this_ptr);
36653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36655         this_ptr_conv.is_owned = false;
36656         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
36657 }
36658
36659 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
36660         LDKCounterpartyForwardingInfo this_ptr_conv;
36661         this_ptr_conv.inner = untag_ptr(this_ptr);
36662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36664         this_ptr_conv.is_owned = false;
36665         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
36666         return ret_conv;
36667 }
36668
36669 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
36670         LDKCounterpartyForwardingInfo this_ptr_conv;
36671         this_ptr_conv.inner = untag_ptr(this_ptr);
36672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36674         this_ptr_conv.is_owned = false;
36675         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
36676 }
36677
36678 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
36679         LDKCounterpartyForwardingInfo this_ptr_conv;
36680         this_ptr_conv.inner = untag_ptr(this_ptr);
36681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36683         this_ptr_conv.is_owned = false;
36684         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
36685         return ret_conv;
36686 }
36687
36688 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
36689         LDKCounterpartyForwardingInfo this_ptr_conv;
36690         this_ptr_conv.inner = untag_ptr(this_ptr);
36691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36693         this_ptr_conv.is_owned = false;
36694         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
36695 }
36696
36697 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) {
36698         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
36699         uint64_t ret_ref = 0;
36700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36702         return ret_ref;
36703 }
36704
36705 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
36706         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
36707         uint64_t ret_ref = 0;
36708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36710         return ret_ref;
36711 }
36712 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
36713         LDKCounterpartyForwardingInfo arg_conv;
36714         arg_conv.inner = untag_ptr(arg);
36715         arg_conv.is_owned = ptr_is_owned(arg);
36716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36717         arg_conv.is_owned = false;
36718         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
36719         return ret_conv;
36720 }
36721
36722 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
36723         LDKCounterpartyForwardingInfo orig_conv;
36724         orig_conv.inner = untag_ptr(orig);
36725         orig_conv.is_owned = ptr_is_owned(orig);
36726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36727         orig_conv.is_owned = false;
36728         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
36729         uint64_t ret_ref = 0;
36730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36732         return ret_ref;
36733 }
36734
36735 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
36736         LDKChannelCounterparty this_obj_conv;
36737         this_obj_conv.inner = untag_ptr(this_obj);
36738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36740         ChannelCounterparty_free(this_obj_conv);
36741 }
36742
36743 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
36744         LDKChannelCounterparty this_ptr_conv;
36745         this_ptr_conv.inner = untag_ptr(this_ptr);
36746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36748         this_ptr_conv.is_owned = false;
36749         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36750         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
36751         return ret_arr;
36752 }
36753
36754 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
36755         LDKChannelCounterparty this_ptr_conv;
36756         this_ptr_conv.inner = untag_ptr(this_ptr);
36757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36759         this_ptr_conv.is_owned = false;
36760         LDKPublicKey val_ref;
36761         CHECK(val->arr_len == 33);
36762         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36763         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
36764 }
36765
36766 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
36767         LDKChannelCounterparty this_ptr_conv;
36768         this_ptr_conv.inner = untag_ptr(this_ptr);
36769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36771         this_ptr_conv.is_owned = false;
36772         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
36773         uint64_t ret_ref = 0;
36774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36776         return ret_ref;
36777 }
36778
36779 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
36780         LDKChannelCounterparty this_ptr_conv;
36781         this_ptr_conv.inner = untag_ptr(this_ptr);
36782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36784         this_ptr_conv.is_owned = false;
36785         LDKInitFeatures val_conv;
36786         val_conv.inner = untag_ptr(val);
36787         val_conv.is_owned = ptr_is_owned(val);
36788         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36789         val_conv = InitFeatures_clone(&val_conv);
36790         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
36791 }
36792
36793 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
36794         LDKChannelCounterparty this_ptr_conv;
36795         this_ptr_conv.inner = untag_ptr(this_ptr);
36796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36798         this_ptr_conv.is_owned = false;
36799         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
36800         return ret_conv;
36801 }
36802
36803 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
36804         LDKChannelCounterparty this_ptr_conv;
36805         this_ptr_conv.inner = untag_ptr(this_ptr);
36806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36808         this_ptr_conv.is_owned = false;
36809         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
36810 }
36811
36812 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
36813         LDKChannelCounterparty this_ptr_conv;
36814         this_ptr_conv.inner = untag_ptr(this_ptr);
36815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36817         this_ptr_conv.is_owned = false;
36818         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
36819         uint64_t ret_ref = 0;
36820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36822         return ret_ref;
36823 }
36824
36825 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
36826         LDKChannelCounterparty this_ptr_conv;
36827         this_ptr_conv.inner = untag_ptr(this_ptr);
36828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36830         this_ptr_conv.is_owned = false;
36831         LDKCounterpartyForwardingInfo val_conv;
36832         val_conv.inner = untag_ptr(val);
36833         val_conv.is_owned = ptr_is_owned(val);
36834         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36835         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
36836         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
36837 }
36838
36839 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
36840         LDKChannelCounterparty this_ptr_conv;
36841         this_ptr_conv.inner = untag_ptr(this_ptr);
36842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36844         this_ptr_conv.is_owned = false;
36845         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36846         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
36847         uint64_t ret_ref = tag_ptr(ret_copy, true);
36848         return ret_ref;
36849 }
36850
36851 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) {
36852         LDKChannelCounterparty this_ptr_conv;
36853         this_ptr_conv.inner = untag_ptr(this_ptr);
36854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36856         this_ptr_conv.is_owned = false;
36857         void* val_ptr = untag_ptr(val);
36858         CHECK_ACCESS(val_ptr);
36859         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36860         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36861         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
36862 }
36863
36864 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
36865         LDKChannelCounterparty this_ptr_conv;
36866         this_ptr_conv.inner = untag_ptr(this_ptr);
36867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36869         this_ptr_conv.is_owned = false;
36870         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36871         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
36872         uint64_t ret_ref = tag_ptr(ret_copy, true);
36873         return ret_ref;
36874 }
36875
36876 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) {
36877         LDKChannelCounterparty 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         void* val_ptr = untag_ptr(val);
36883         CHECK_ACCESS(val_ptr);
36884         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36885         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36886         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
36887 }
36888
36889 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) {
36890         LDKPublicKey node_id_arg_ref;
36891         CHECK(node_id_arg->arr_len == 33);
36892         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
36893         LDKInitFeatures features_arg_conv;
36894         features_arg_conv.inner = untag_ptr(features_arg);
36895         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36896         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36897         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36898         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
36899         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
36900         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
36901         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
36902         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
36903         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
36904         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
36905         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
36906         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
36907         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
36908         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
36909         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
36910         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
36911         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);
36912         uint64_t ret_ref = 0;
36913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36915         return ret_ref;
36916 }
36917
36918 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
36919         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
36920         uint64_t ret_ref = 0;
36921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36923         return ret_ref;
36924 }
36925 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
36926         LDKChannelCounterparty arg_conv;
36927         arg_conv.inner = untag_ptr(arg);
36928         arg_conv.is_owned = ptr_is_owned(arg);
36929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36930         arg_conv.is_owned = false;
36931         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
36932         return ret_conv;
36933 }
36934
36935 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
36936         LDKChannelCounterparty orig_conv;
36937         orig_conv.inner = untag_ptr(orig);
36938         orig_conv.is_owned = ptr_is_owned(orig);
36939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36940         orig_conv.is_owned = false;
36941         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
36942         uint64_t ret_ref = 0;
36943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36945         return ret_ref;
36946 }
36947
36948 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
36949         LDKChannelDetails this_obj_conv;
36950         this_obj_conv.inner = untag_ptr(this_obj);
36951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36953         ChannelDetails_free(this_obj_conv);
36954 }
36955
36956 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
36957         LDKChannelDetails this_ptr_conv;
36958         this_ptr_conv.inner = untag_ptr(this_ptr);
36959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36961         this_ptr_conv.is_owned = false;
36962         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36963         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
36964         return ret_arr;
36965 }
36966
36967 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36968         LDKChannelDetails this_ptr_conv;
36969         this_ptr_conv.inner = untag_ptr(this_ptr);
36970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36972         this_ptr_conv.is_owned = false;
36973         LDKThirtyTwoBytes val_ref;
36974         CHECK(val->arr_len == 32);
36975         memcpy(val_ref.data, val->elems, 32); FREE(val);
36976         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
36977 }
36978
36979 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
36980         LDKChannelDetails this_ptr_conv;
36981         this_ptr_conv.inner = untag_ptr(this_ptr);
36982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36984         this_ptr_conv.is_owned = false;
36985         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
36986         uint64_t ret_ref = 0;
36987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36989         return ret_ref;
36990 }
36991
36992 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
36993         LDKChannelDetails this_ptr_conv;
36994         this_ptr_conv.inner = untag_ptr(this_ptr);
36995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36997         this_ptr_conv.is_owned = false;
36998         LDKChannelCounterparty val_conv;
36999         val_conv.inner = untag_ptr(val);
37000         val_conv.is_owned = ptr_is_owned(val);
37001         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37002         val_conv = ChannelCounterparty_clone(&val_conv);
37003         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
37004 }
37005
37006 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
37007         LDKChannelDetails this_ptr_conv;
37008         this_ptr_conv.inner = untag_ptr(this_ptr);
37009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37011         this_ptr_conv.is_owned = false;
37012         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
37013         uint64_t ret_ref = 0;
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37016         return ret_ref;
37017 }
37018
37019 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
37020         LDKChannelDetails this_ptr_conv;
37021         this_ptr_conv.inner = untag_ptr(this_ptr);
37022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37024         this_ptr_conv.is_owned = false;
37025         LDKOutPoint val_conv;
37026         val_conv.inner = untag_ptr(val);
37027         val_conv.is_owned = ptr_is_owned(val);
37028         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37029         val_conv = OutPoint_clone(&val_conv);
37030         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
37031 }
37032
37033 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
37034         LDKChannelDetails this_ptr_conv;
37035         this_ptr_conv.inner = untag_ptr(this_ptr);
37036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37038         this_ptr_conv.is_owned = false;
37039         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
37040         uint64_t ret_ref = 0;
37041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37043         return ret_ref;
37044 }
37045
37046 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
37047         LDKChannelDetails this_ptr_conv;
37048         this_ptr_conv.inner = untag_ptr(this_ptr);
37049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37051         this_ptr_conv.is_owned = false;
37052         LDKChannelTypeFeatures val_conv;
37053         val_conv.inner = untag_ptr(val);
37054         val_conv.is_owned = ptr_is_owned(val);
37055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37056         val_conv = ChannelTypeFeatures_clone(&val_conv);
37057         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
37058 }
37059
37060 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
37061         LDKChannelDetails this_ptr_conv;
37062         this_ptr_conv.inner = untag_ptr(this_ptr);
37063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37065         this_ptr_conv.is_owned = false;
37066         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37067         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
37068         uint64_t ret_ref = tag_ptr(ret_copy, true);
37069         return ret_ref;
37070 }
37071
37072 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
37073         LDKChannelDetails this_ptr_conv;
37074         this_ptr_conv.inner = untag_ptr(this_ptr);
37075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37077         this_ptr_conv.is_owned = false;
37078         void* val_ptr = untag_ptr(val);
37079         CHECK_ACCESS(val_ptr);
37080         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37081         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37082         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
37083 }
37084
37085 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
37086         LDKChannelDetails this_ptr_conv;
37087         this_ptr_conv.inner = untag_ptr(this_ptr);
37088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37090         this_ptr_conv.is_owned = false;
37091         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37092         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
37093         uint64_t ret_ref = tag_ptr(ret_copy, true);
37094         return ret_ref;
37095 }
37096
37097 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
37098         LDKChannelDetails this_ptr_conv;
37099         this_ptr_conv.inner = untag_ptr(this_ptr);
37100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37102         this_ptr_conv.is_owned = false;
37103         void* val_ptr = untag_ptr(val);
37104         CHECK_ACCESS(val_ptr);
37105         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37106         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37107         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
37108 }
37109
37110 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
37111         LDKChannelDetails this_ptr_conv;
37112         this_ptr_conv.inner = untag_ptr(this_ptr);
37113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37115         this_ptr_conv.is_owned = false;
37116         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37117         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
37118         uint64_t ret_ref = tag_ptr(ret_copy, true);
37119         return ret_ref;
37120 }
37121
37122 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
37123         LDKChannelDetails this_ptr_conv;
37124         this_ptr_conv.inner = untag_ptr(this_ptr);
37125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37127         this_ptr_conv.is_owned = false;
37128         void* val_ptr = untag_ptr(val);
37129         CHECK_ACCESS(val_ptr);
37130         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37131         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37132         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
37133 }
37134
37135 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
37136         LDKChannelDetails this_ptr_conv;
37137         this_ptr_conv.inner = untag_ptr(this_ptr);
37138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37140         this_ptr_conv.is_owned = false;
37141         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
37142         return ret_conv;
37143 }
37144
37145 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
37146         LDKChannelDetails this_ptr_conv;
37147         this_ptr_conv.inner = untag_ptr(this_ptr);
37148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37150         this_ptr_conv.is_owned = false;
37151         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
37152 }
37153
37154 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
37155         LDKChannelDetails this_ptr_conv;
37156         this_ptr_conv.inner = untag_ptr(this_ptr);
37157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37159         this_ptr_conv.is_owned = false;
37160         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37161         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
37162         uint64_t ret_ref = tag_ptr(ret_copy, true);
37163         return ret_ref;
37164 }
37165
37166 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
37167         LDKChannelDetails this_ptr_conv;
37168         this_ptr_conv.inner = untag_ptr(this_ptr);
37169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37171         this_ptr_conv.is_owned = false;
37172         void* val_ptr = untag_ptr(val);
37173         CHECK_ACCESS(val_ptr);
37174         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37175         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37176         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
37177 }
37178
37179 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
37180         LDKChannelDetails this_ptr_conv;
37181         this_ptr_conv.inner = untag_ptr(this_ptr);
37182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37184         this_ptr_conv.is_owned = false;
37185         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
37186         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
37187         return ret_arr;
37188 }
37189
37190 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
37191         LDKChannelDetails this_ptr_conv;
37192         this_ptr_conv.inner = untag_ptr(this_ptr);
37193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37195         this_ptr_conv.is_owned = false;
37196         LDKU128 val_ref;
37197         CHECK(val->arr_len == 16);
37198         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
37199         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
37200 }
37201
37202 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) {
37203         LDKChannelDetails this_ptr_conv;
37204         this_ptr_conv.inner = untag_ptr(this_ptr);
37205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37207         this_ptr_conv.is_owned = false;
37208         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37209         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
37210         uint64_t ret_ref = tag_ptr(ret_copy, true);
37211         return ret_ref;
37212 }
37213
37214 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) {
37215         LDKChannelDetails this_ptr_conv;
37216         this_ptr_conv.inner = untag_ptr(this_ptr);
37217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37219         this_ptr_conv.is_owned = false;
37220         void* val_ptr = untag_ptr(val);
37221         CHECK_ACCESS(val_ptr);
37222         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37223         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37224         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
37225 }
37226
37227 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
37228         LDKChannelDetails this_ptr_conv;
37229         this_ptr_conv.inner = untag_ptr(this_ptr);
37230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37232         this_ptr_conv.is_owned = false;
37233         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
37234         return ret_conv;
37235 }
37236
37237 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
37238         LDKChannelDetails this_ptr_conv;
37239         this_ptr_conv.inner = untag_ptr(this_ptr);
37240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37242         this_ptr_conv.is_owned = false;
37243         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
37244 }
37245
37246 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
37247         LDKChannelDetails this_ptr_conv;
37248         this_ptr_conv.inner = untag_ptr(this_ptr);
37249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37251         this_ptr_conv.is_owned = false;
37252         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
37253         return ret_conv;
37254 }
37255
37256 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
37257         LDKChannelDetails this_ptr_conv;
37258         this_ptr_conv.inner = untag_ptr(this_ptr);
37259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37261         this_ptr_conv.is_owned = false;
37262         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
37263 }
37264
37265 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) {
37266         LDKChannelDetails this_ptr_conv;
37267         this_ptr_conv.inner = untag_ptr(this_ptr);
37268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37270         this_ptr_conv.is_owned = false;
37271         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
37272         return ret_conv;
37273 }
37274
37275 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) {
37276         LDKChannelDetails this_ptr_conv;
37277         this_ptr_conv.inner = untag_ptr(this_ptr);
37278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37280         this_ptr_conv.is_owned = false;
37281         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
37282 }
37283
37284 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) {
37285         LDKChannelDetails this_ptr_conv;
37286         this_ptr_conv.inner = untag_ptr(this_ptr);
37287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37289         this_ptr_conv.is_owned = false;
37290         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
37291         return ret_conv;
37292 }
37293
37294 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) {
37295         LDKChannelDetails this_ptr_conv;
37296         this_ptr_conv.inner = untag_ptr(this_ptr);
37297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37299         this_ptr_conv.is_owned = false;
37300         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
37301 }
37302
37303 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
37304         LDKChannelDetails this_ptr_conv;
37305         this_ptr_conv.inner = untag_ptr(this_ptr);
37306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37308         this_ptr_conv.is_owned = false;
37309         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
37310         return ret_conv;
37311 }
37312
37313 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
37314         LDKChannelDetails this_ptr_conv;
37315         this_ptr_conv.inner = untag_ptr(this_ptr);
37316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37318         this_ptr_conv.is_owned = false;
37319         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
37320 }
37321
37322 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
37323         LDKChannelDetails this_ptr_conv;
37324         this_ptr_conv.inner = untag_ptr(this_ptr);
37325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37327         this_ptr_conv.is_owned = false;
37328         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37329         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
37330         uint64_t ret_ref = tag_ptr(ret_copy, true);
37331         return ret_ref;
37332 }
37333
37334 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
37335         LDKChannelDetails this_ptr_conv;
37336         this_ptr_conv.inner = untag_ptr(this_ptr);
37337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37339         this_ptr_conv.is_owned = false;
37340         void* val_ptr = untag_ptr(val);
37341         CHECK_ACCESS(val_ptr);
37342         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37343         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37344         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
37345 }
37346
37347 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
37348         LDKChannelDetails this_ptr_conv;
37349         this_ptr_conv.inner = untag_ptr(this_ptr);
37350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37352         this_ptr_conv.is_owned = false;
37353         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37354         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
37355         uint64_t ret_ref = tag_ptr(ret_copy, true);
37356         return ret_ref;
37357 }
37358
37359 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
37360         LDKChannelDetails this_ptr_conv;
37361         this_ptr_conv.inner = untag_ptr(this_ptr);
37362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37364         this_ptr_conv.is_owned = false;
37365         void* val_ptr = untag_ptr(val);
37366         CHECK_ACCESS(val_ptr);
37367         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37368         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37369         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
37370 }
37371
37372 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
37373         LDKChannelDetails this_ptr_conv;
37374         this_ptr_conv.inner = untag_ptr(this_ptr);
37375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37377         this_ptr_conv.is_owned = false;
37378         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37379         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
37380         uint64_t ret_ref = tag_ptr(ret_copy, true);
37381         return ret_ref;
37382 }
37383
37384 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) {
37385         LDKChannelDetails this_ptr_conv;
37386         this_ptr_conv.inner = untag_ptr(this_ptr);
37387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37389         this_ptr_conv.is_owned = false;
37390         void* val_ptr = untag_ptr(val);
37391         CHECK_ACCESS(val_ptr);
37392         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37393         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37394         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
37395 }
37396
37397 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
37398         LDKChannelDetails this_ptr_conv;
37399         this_ptr_conv.inner = untag_ptr(this_ptr);
37400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37402         this_ptr_conv.is_owned = false;
37403         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
37404         return ret_conv;
37405 }
37406
37407 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
37408         LDKChannelDetails this_ptr_conv;
37409         this_ptr_conv.inner = untag_ptr(this_ptr);
37410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37412         this_ptr_conv.is_owned = false;
37413         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
37414 }
37415
37416 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
37417         LDKChannelDetails this_ptr_conv;
37418         this_ptr_conv.inner = untag_ptr(this_ptr);
37419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37421         this_ptr_conv.is_owned = false;
37422         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
37423         return ret_conv;
37424 }
37425
37426 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
37427         LDKChannelDetails this_ptr_conv;
37428         this_ptr_conv.inner = untag_ptr(this_ptr);
37429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37431         this_ptr_conv.is_owned = false;
37432         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
37433 }
37434
37435 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
37436         LDKChannelDetails 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         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
37442         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
37443         uint64_t ret_ref = tag_ptr(ret_copy, true);
37444         return ret_ref;
37445 }
37446
37447 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
37448         LDKChannelDetails this_ptr_conv;
37449         this_ptr_conv.inner = untag_ptr(this_ptr);
37450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37452         this_ptr_conv.is_owned = false;
37453         void* val_ptr = untag_ptr(val);
37454         CHECK_ACCESS(val_ptr);
37455         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
37456         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
37457         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
37458 }
37459
37460 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
37461         LDKChannelDetails this_ptr_conv;
37462         this_ptr_conv.inner = untag_ptr(this_ptr);
37463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37465         this_ptr_conv.is_owned = false;
37466         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
37467         return ret_conv;
37468 }
37469
37470 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
37471         LDKChannelDetails this_ptr_conv;
37472         this_ptr_conv.inner = untag_ptr(this_ptr);
37473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37475         this_ptr_conv.is_owned = false;
37476         ChannelDetails_set_is_usable(&this_ptr_conv, val);
37477 }
37478
37479 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
37480         LDKChannelDetails this_ptr_conv;
37481         this_ptr_conv.inner = untag_ptr(this_ptr);
37482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37484         this_ptr_conv.is_owned = false;
37485         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
37486         return ret_conv;
37487 }
37488
37489 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
37490         LDKChannelDetails this_ptr_conv;
37491         this_ptr_conv.inner = untag_ptr(this_ptr);
37492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37494         this_ptr_conv.is_owned = false;
37495         ChannelDetails_set_is_public(&this_ptr_conv, val);
37496 }
37497
37498 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
37499         LDKChannelDetails this_ptr_conv;
37500         this_ptr_conv.inner = untag_ptr(this_ptr);
37501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37503         this_ptr_conv.is_owned = false;
37504         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37505         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
37506         uint64_t ret_ref = tag_ptr(ret_copy, true);
37507         return ret_ref;
37508 }
37509
37510 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) {
37511         LDKChannelDetails this_ptr_conv;
37512         this_ptr_conv.inner = untag_ptr(this_ptr);
37513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37515         this_ptr_conv.is_owned = false;
37516         void* val_ptr = untag_ptr(val);
37517         CHECK_ACCESS(val_ptr);
37518         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37519         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37520         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37521 }
37522
37523 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
37524         LDKChannelDetails this_ptr_conv;
37525         this_ptr_conv.inner = untag_ptr(this_ptr);
37526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37528         this_ptr_conv.is_owned = false;
37529         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37530         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
37531         uint64_t ret_ref = tag_ptr(ret_copy, true);
37532         return ret_ref;
37533 }
37534
37535 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) {
37536         LDKChannelDetails this_ptr_conv;
37537         this_ptr_conv.inner = untag_ptr(this_ptr);
37538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37540         this_ptr_conv.is_owned = false;
37541         void* val_ptr = untag_ptr(val);
37542         CHECK_ACCESS(val_ptr);
37543         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37544         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37545         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37546 }
37547
37548 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
37549         LDKChannelDetails this_ptr_conv;
37550         this_ptr_conv.inner = untag_ptr(this_ptr);
37551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37553         this_ptr_conv.is_owned = false;
37554         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
37555         uint64_t ret_ref = 0;
37556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37558         return ret_ref;
37559 }
37560
37561 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
37562         LDKChannelDetails this_ptr_conv;
37563         this_ptr_conv.inner = untag_ptr(this_ptr);
37564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37566         this_ptr_conv.is_owned = false;
37567         LDKChannelConfig val_conv;
37568         val_conv.inner = untag_ptr(val);
37569         val_conv.is_owned = ptr_is_owned(val);
37570         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37571         val_conv = ChannelConfig_clone(&val_conv);
37572         ChannelDetails_set_config(&this_ptr_conv, val_conv);
37573 }
37574
37575 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) {
37576         LDKThirtyTwoBytes channel_id_arg_ref;
37577         CHECK(channel_id_arg->arr_len == 32);
37578         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37579         LDKChannelCounterparty counterparty_arg_conv;
37580         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
37581         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
37582         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
37583         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
37584         LDKOutPoint funding_txo_arg_conv;
37585         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
37586         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
37587         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
37588         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
37589         LDKChannelTypeFeatures channel_type_arg_conv;
37590         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37591         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37592         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37593         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37594         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
37595         CHECK_ACCESS(short_channel_id_arg_ptr);
37596         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
37597         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
37598         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
37599         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
37600         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
37601         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
37602         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
37603         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
37604         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
37605         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
37606         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
37607         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
37608         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
37609         LDKU128 user_channel_id_arg_ref;
37610         CHECK(user_channel_id_arg->arr_len == 16);
37611         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
37612         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
37613         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
37614         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
37615         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
37616         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
37617         CHECK_ACCESS(confirmations_required_arg_ptr);
37618         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
37619         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
37620         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
37621         CHECK_ACCESS(confirmations_arg_ptr);
37622         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
37623         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
37624         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
37625         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
37626         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
37627         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
37628         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
37629         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
37630         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
37631         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
37632         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
37633         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
37634         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
37635         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
37636         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
37637         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
37638         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
37639         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
37640         LDKChannelConfig config_arg_conv;
37641         config_arg_conv.inner = untag_ptr(config_arg);
37642         config_arg_conv.is_owned = ptr_is_owned(config_arg);
37643         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
37644         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
37645         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);
37646         uint64_t ret_ref = 0;
37647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37649         return ret_ref;
37650 }
37651
37652 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
37653         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
37654         uint64_t ret_ref = 0;
37655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37657         return ret_ref;
37658 }
37659 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
37660         LDKChannelDetails arg_conv;
37661         arg_conv.inner = untag_ptr(arg);
37662         arg_conv.is_owned = ptr_is_owned(arg);
37663         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37664         arg_conv.is_owned = false;
37665         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
37666         return ret_conv;
37667 }
37668
37669 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
37670         LDKChannelDetails orig_conv;
37671         orig_conv.inner = untag_ptr(orig);
37672         orig_conv.is_owned = ptr_is_owned(orig);
37673         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37674         orig_conv.is_owned = false;
37675         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
37676         uint64_t ret_ref = 0;
37677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37679         return ret_ref;
37680 }
37681
37682 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
37683         LDKChannelDetails this_arg_conv;
37684         this_arg_conv.inner = untag_ptr(this_arg);
37685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37687         this_arg_conv.is_owned = false;
37688         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37689         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
37690         uint64_t ret_ref = tag_ptr(ret_copy, true);
37691         return ret_ref;
37692 }
37693
37694 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
37695         LDKChannelDetails this_arg_conv;
37696         this_arg_conv.inner = untag_ptr(this_arg);
37697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37699         this_arg_conv.is_owned = false;
37700         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37701         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
37702         uint64_t ret_ref = tag_ptr(ret_copy, true);
37703         return ret_ref;
37704 }
37705
37706 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
37707         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
37708         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
37709         return ret_conv;
37710 }
37711
37712 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
37713         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
37714         return ret_conv;
37715 }
37716
37717 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
37718         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
37719         return ret_conv;
37720 }
37721
37722 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
37723         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
37724         return ret_conv;
37725 }
37726
37727 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
37728         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
37729         return ret_conv;
37730 }
37731
37732 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
37733         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
37734         return ret_conv;
37735 }
37736
37737 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
37738         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
37739         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
37740         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
37741         return ret_conv;
37742 }
37743
37744 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
37745         if (!ptr_is_owned(this_ptr)) return;
37746         void* this_ptr_ptr = untag_ptr(this_ptr);
37747         CHECK_ACCESS(this_ptr_ptr);
37748         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
37749         FREE(untag_ptr(this_ptr));
37750         RecentPaymentDetails_free(this_ptr_conv);
37751 }
37752
37753 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
37754         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37755         *ret_copy = RecentPaymentDetails_clone(arg);
37756         uint64_t ret_ref = tag_ptr(ret_copy, true);
37757         return ret_ref;
37758 }
37759 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
37760         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
37761         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
37762         return ret_conv;
37763 }
37764
37765 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
37766         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
37767         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37768         *ret_copy = RecentPaymentDetails_clone(orig_conv);
37769         uint64_t ret_ref = tag_ptr(ret_copy, true);
37770         return ret_ref;
37771 }
37772
37773 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
37774         LDKThirtyTwoBytes payment_id_ref;
37775         CHECK(payment_id->arr_len == 32);
37776         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37777         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37778         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
37779         uint64_t ret_ref = tag_ptr(ret_copy, true);
37780         return ret_ref;
37781 }
37782
37783 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
37784         LDKThirtyTwoBytes payment_id_ref;
37785         CHECK(payment_id->arr_len == 32);
37786         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37787         LDKThirtyTwoBytes payment_hash_ref;
37788         CHECK(payment_hash->arr_len == 32);
37789         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
37790         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37791         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
37792         uint64_t ret_ref = tag_ptr(ret_copy, true);
37793         return ret_ref;
37794 }
37795
37796 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
37797         LDKThirtyTwoBytes payment_id_ref;
37798         CHECK(payment_id->arr_len == 32);
37799         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37800         void* payment_hash_ptr = untag_ptr(payment_hash);
37801         CHECK_ACCESS(payment_hash_ptr);
37802         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
37803         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
37804         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37805         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
37806         uint64_t ret_ref = tag_ptr(ret_copy, true);
37807         return ret_ref;
37808 }
37809
37810 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
37811         LDKThirtyTwoBytes payment_id_ref;
37812         CHECK(payment_id->arr_len == 32);
37813         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37814         LDKThirtyTwoBytes payment_hash_ref;
37815         CHECK(payment_hash->arr_len == 32);
37816         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
37817         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37818         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
37819         uint64_t ret_ref = tag_ptr(ret_copy, true);
37820         return ret_ref;
37821 }
37822
37823 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
37824         LDKPhantomRouteHints this_obj_conv;
37825         this_obj_conv.inner = untag_ptr(this_obj);
37826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37828         PhantomRouteHints_free(this_obj_conv);
37829 }
37830
37831 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
37832         LDKPhantomRouteHints this_ptr_conv;
37833         this_ptr_conv.inner = untag_ptr(this_ptr);
37834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37836         this_ptr_conv.is_owned = false;
37837         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
37838         uint64_tArray ret_arr = NULL;
37839         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37840         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37841         for (size_t q = 0; q < ret_var.datalen; q++) {
37842                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
37843                 uint64_t ret_conv_16_ref = 0;
37844                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37845                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
37846                 ret_arr_ptr[q] = ret_conv_16_ref;
37847         }
37848         
37849         FREE(ret_var.data);
37850         return ret_arr;
37851 }
37852
37853 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
37854         LDKPhantomRouteHints this_ptr_conv;
37855         this_ptr_conv.inner = untag_ptr(this_ptr);
37856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37858         this_ptr_conv.is_owned = false;
37859         LDKCVec_ChannelDetailsZ val_constr;
37860         val_constr.datalen = val->arr_len;
37861         if (val_constr.datalen > 0)
37862                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37863         else
37864                 val_constr.data = NULL;
37865         uint64_t* val_vals = val->elems;
37866         for (size_t q = 0; q < val_constr.datalen; q++) {
37867                 uint64_t val_conv_16 = val_vals[q];
37868                 LDKChannelDetails val_conv_16_conv;
37869                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
37870                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
37871                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37872                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
37873                 val_constr.data[q] = val_conv_16_conv;
37874         }
37875         FREE(val);
37876         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
37877 }
37878
37879 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
37880         LDKPhantomRouteHints this_ptr_conv;
37881         this_ptr_conv.inner = untag_ptr(this_ptr);
37882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37884         this_ptr_conv.is_owned = false;
37885         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
37886         return ret_conv;
37887 }
37888
37889 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
37890         LDKPhantomRouteHints this_ptr_conv;
37891         this_ptr_conv.inner = untag_ptr(this_ptr);
37892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37894         this_ptr_conv.is_owned = false;
37895         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
37896 }
37897
37898 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
37899         LDKPhantomRouteHints this_ptr_conv;
37900         this_ptr_conv.inner = untag_ptr(this_ptr);
37901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37903         this_ptr_conv.is_owned = false;
37904         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37905         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
37906         return ret_arr;
37907 }
37908
37909 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
37910         LDKPhantomRouteHints this_ptr_conv;
37911         this_ptr_conv.inner = untag_ptr(this_ptr);
37912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37914         this_ptr_conv.is_owned = false;
37915         LDKPublicKey val_ref;
37916         CHECK(val->arr_len == 33);
37917         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37918         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
37919 }
37920
37921 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) {
37922         LDKCVec_ChannelDetailsZ channels_arg_constr;
37923         channels_arg_constr.datalen = channels_arg->arr_len;
37924         if (channels_arg_constr.datalen > 0)
37925                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37926         else
37927                 channels_arg_constr.data = NULL;
37928         uint64_t* channels_arg_vals = channels_arg->elems;
37929         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
37930                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
37931                 LDKChannelDetails channels_arg_conv_16_conv;
37932                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
37933                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
37934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
37935                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
37936                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
37937         }
37938         FREE(channels_arg);
37939         LDKPublicKey real_node_pubkey_arg_ref;
37940         CHECK(real_node_pubkey_arg->arr_len == 33);
37941         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
37942         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
37943         uint64_t ret_ref = 0;
37944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37946         return ret_ref;
37947 }
37948
37949 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
37950         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
37951         uint64_t ret_ref = 0;
37952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37954         return ret_ref;
37955 }
37956 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
37957         LDKPhantomRouteHints arg_conv;
37958         arg_conv.inner = untag_ptr(arg);
37959         arg_conv.is_owned = ptr_is_owned(arg);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37961         arg_conv.is_owned = false;
37962         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
37963         return ret_conv;
37964 }
37965
37966 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
37967         LDKPhantomRouteHints orig_conv;
37968         orig_conv.inner = untag_ptr(orig);
37969         orig_conv.is_owned = ptr_is_owned(orig);
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37971         orig_conv.is_owned = false;
37972         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
37973         uint64_t ret_ref = 0;
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37976         return ret_ref;
37977 }
37978
37979 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) {
37980         void* fee_est_ptr = untag_ptr(fee_est);
37981         CHECK_ACCESS(fee_est_ptr);
37982         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
37983         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
37984                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37985                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
37986         }
37987         void* chain_monitor_ptr = untag_ptr(chain_monitor);
37988         CHECK_ACCESS(chain_monitor_ptr);
37989         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
37990         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
37991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37992                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
37993         }
37994         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
37995         CHECK_ACCESS(tx_broadcaster_ptr);
37996         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
37997         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37999                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
38000         }
38001         void* router_ptr = untag_ptr(router);
38002         CHECK_ACCESS(router_ptr);
38003         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
38004         if (router_conv.free == LDKRouter_JCalls_free) {
38005                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38006                 LDKRouter_JCalls_cloned(&router_conv);
38007         }
38008         void* logger_ptr = untag_ptr(logger);
38009         CHECK_ACCESS(logger_ptr);
38010         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38011         if (logger_conv.free == LDKLogger_JCalls_free) {
38012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38013                 LDKLogger_JCalls_cloned(&logger_conv);
38014         }
38015         void* entropy_source_ptr = untag_ptr(entropy_source);
38016         CHECK_ACCESS(entropy_source_ptr);
38017         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
38018         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
38019                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38020                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
38021         }
38022         void* node_signer_ptr = untag_ptr(node_signer);
38023         CHECK_ACCESS(node_signer_ptr);
38024         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
38025         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
38026                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38027                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
38028         }
38029         void* signer_provider_ptr = untag_ptr(signer_provider);
38030         CHECK_ACCESS(signer_provider_ptr);
38031         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
38032         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
38033                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38034                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
38035         }
38036         LDKUserConfig config_conv;
38037         config_conv.inner = untag_ptr(config);
38038         config_conv.is_owned = ptr_is_owned(config);
38039         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38040         config_conv = UserConfig_clone(&config_conv);
38041         LDKChainParameters params_conv;
38042         params_conv.inner = untag_ptr(params);
38043         params_conv.is_owned = ptr_is_owned(params);
38044         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38045         params_conv = ChainParameters_clone(&params_conv);
38046         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);
38047         uint64_t ret_ref = 0;
38048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38050         return ret_ref;
38051 }
38052
38053 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
38054         LDKChannelManager this_arg_conv;
38055         this_arg_conv.inner = untag_ptr(this_arg);
38056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38058         this_arg_conv.is_owned = false;
38059         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
38060         uint64_t ret_ref = 0;
38061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38063         return ret_ref;
38064 }
38065
38066 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 temporary_channel_id, uint64_t override_config) {
38067         LDKChannelManager this_arg_conv;
38068         this_arg_conv.inner = untag_ptr(this_arg);
38069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38071         this_arg_conv.is_owned = false;
38072         LDKPublicKey their_network_key_ref;
38073         CHECK(their_network_key->arr_len == 33);
38074         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
38075         LDKU128 user_channel_id_ref;
38076         CHECK(user_channel_id->arr_len == 16);
38077         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38078         void* temporary_channel_id_ptr = untag_ptr(temporary_channel_id);
38079         CHECK_ACCESS(temporary_channel_id_ptr);
38080         LDKCOption_ThirtyTwoBytesZ temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(temporary_channel_id_ptr);
38081         temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(temporary_channel_id));
38082         LDKUserConfig override_config_conv;
38083         override_config_conv.inner = untag_ptr(override_config);
38084         override_config_conv.is_owned = ptr_is_owned(override_config);
38085         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
38086         override_config_conv = UserConfig_clone(&override_config_conv);
38087         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
38088         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, temporary_channel_id_conv, override_config_conv);
38089         return tag_ptr(ret_conv, true);
38090 }
38091
38092 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
38093         LDKChannelManager this_arg_conv;
38094         this_arg_conv.inner = untag_ptr(this_arg);
38095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38097         this_arg_conv.is_owned = false;
38098         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
38099         uint64_tArray ret_arr = NULL;
38100         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38101         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38102         for (size_t q = 0; q < ret_var.datalen; q++) {
38103                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38104                 uint64_t ret_conv_16_ref = 0;
38105                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38106                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38107                 ret_arr_ptr[q] = ret_conv_16_ref;
38108         }
38109         
38110         FREE(ret_var.data);
38111         return ret_arr;
38112 }
38113
38114 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
38115         LDKChannelManager this_arg_conv;
38116         this_arg_conv.inner = untag_ptr(this_arg);
38117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38119         this_arg_conv.is_owned = false;
38120         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
38121         uint64_tArray ret_arr = NULL;
38122         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38123         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38124         for (size_t q = 0; q < ret_var.datalen; q++) {
38125                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38126                 uint64_t ret_conv_16_ref = 0;
38127                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38128                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38129                 ret_arr_ptr[q] = ret_conv_16_ref;
38130         }
38131         
38132         FREE(ret_var.data);
38133         return ret_arr;
38134 }
38135
38136 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) {
38137         LDKChannelManager this_arg_conv;
38138         this_arg_conv.inner = untag_ptr(this_arg);
38139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38141         this_arg_conv.is_owned = false;
38142         LDKPublicKey counterparty_node_id_ref;
38143         CHECK(counterparty_node_id->arr_len == 33);
38144         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38145         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
38146         uint64_tArray ret_arr = NULL;
38147         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38148         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38149         for (size_t q = 0; q < ret_var.datalen; q++) {
38150                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38151                 uint64_t ret_conv_16_ref = 0;
38152                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38153                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38154                 ret_arr_ptr[q] = ret_conv_16_ref;
38155         }
38156         
38157         FREE(ret_var.data);
38158         return ret_arr;
38159 }
38160
38161 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
38162         LDKChannelManager this_arg_conv;
38163         this_arg_conv.inner = untag_ptr(this_arg);
38164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38166         this_arg_conv.is_owned = false;
38167         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
38168         uint64_tArray ret_arr = NULL;
38169         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38170         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38171         for (size_t w = 0; w < ret_var.datalen; w++) {
38172                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38173                 *ret_conv_22_copy = ret_var.data[w];
38174                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
38175                 ret_arr_ptr[w] = ret_conv_22_ref;
38176         }
38177         
38178         FREE(ret_var.data);
38179         return ret_arr;
38180 }
38181
38182 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) {
38183         LDKChannelManager this_arg_conv;
38184         this_arg_conv.inner = untag_ptr(this_arg);
38185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38187         this_arg_conv.is_owned = false;
38188         uint8_t channel_id_arr[32];
38189         CHECK(channel_id->arr_len == 32);
38190         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38191         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38192         LDKPublicKey counterparty_node_id_ref;
38193         CHECK(counterparty_node_id->arr_len == 33);
38194         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38195         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38196         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38197         return tag_ptr(ret_conv, true);
38198 }
38199
38200 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) {
38201         LDKChannelManager this_arg_conv;
38202         this_arg_conv.inner = untag_ptr(this_arg);
38203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38205         this_arg_conv.is_owned = false;
38206         uint8_t channel_id_arr[32];
38207         CHECK(channel_id->arr_len == 32);
38208         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38209         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38210         LDKPublicKey counterparty_node_id_ref;
38211         CHECK(counterparty_node_id->arr_len == 33);
38212         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38213         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
38214         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
38215         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
38216         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
38217         LDKShutdownScript shutdown_script_conv;
38218         shutdown_script_conv.inner = untag_ptr(shutdown_script);
38219         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
38220         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
38221         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
38222         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38223         *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);
38224         return tag_ptr(ret_conv, true);
38225 }
38226
38227 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) {
38228         LDKChannelManager this_arg_conv;
38229         this_arg_conv.inner = untag_ptr(this_arg);
38230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38232         this_arg_conv.is_owned = false;
38233         uint8_t channel_id_arr[32];
38234         CHECK(channel_id->arr_len == 32);
38235         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38236         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38237         LDKPublicKey counterparty_node_id_ref;
38238         CHECK(counterparty_node_id->arr_len == 33);
38239         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38240         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38241         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38242         return tag_ptr(ret_conv, true);
38243 }
38244
38245 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) {
38246         LDKChannelManager this_arg_conv;
38247         this_arg_conv.inner = untag_ptr(this_arg);
38248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38250         this_arg_conv.is_owned = false;
38251         uint8_t channel_id_arr[32];
38252         CHECK(channel_id->arr_len == 32);
38253         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38254         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38255         LDKPublicKey counterparty_node_id_ref;
38256         CHECK(counterparty_node_id->arr_len == 33);
38257         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38258         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38259         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38260         return tag_ptr(ret_conv, true);
38261 }
38262
38263 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) {
38264         LDKChannelManager this_arg_conv;
38265         this_arg_conv.inner = untag_ptr(this_arg);
38266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38268         this_arg_conv.is_owned = false;
38269         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
38270 }
38271
38272 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) {
38273         LDKChannelManager this_arg_conv;
38274         this_arg_conv.inner = untag_ptr(this_arg);
38275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38277         this_arg_conv.is_owned = false;
38278         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
38279 }
38280
38281 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) {
38282         LDKChannelManager this_arg_conv;
38283         this_arg_conv.inner = untag_ptr(this_arg);
38284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38286         this_arg_conv.is_owned = false;
38287         LDKRoute route_conv;
38288         route_conv.inner = untag_ptr(route);
38289         route_conv.is_owned = ptr_is_owned(route);
38290         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38291         route_conv.is_owned = false;
38292         LDKThirtyTwoBytes payment_hash_ref;
38293         CHECK(payment_hash->arr_len == 32);
38294         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38295         LDKRecipientOnionFields recipient_onion_conv;
38296         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38297         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38298         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38299         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38300         LDKThirtyTwoBytes payment_id_ref;
38301         CHECK(payment_id->arr_len == 32);
38302         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38303         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
38304         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
38305         return tag_ptr(ret_conv, true);
38306 }
38307
38308 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) {
38309         LDKChannelManager this_arg_conv;
38310         this_arg_conv.inner = untag_ptr(this_arg);
38311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38313         this_arg_conv.is_owned = false;
38314         LDKThirtyTwoBytes payment_hash_ref;
38315         CHECK(payment_hash->arr_len == 32);
38316         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38317         LDKRecipientOnionFields recipient_onion_conv;
38318         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38319         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38320         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38321         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38322         LDKThirtyTwoBytes payment_id_ref;
38323         CHECK(payment_id->arr_len == 32);
38324         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38325         LDKRouteParameters route_params_conv;
38326         route_params_conv.inner = untag_ptr(route_params);
38327         route_params_conv.is_owned = ptr_is_owned(route_params);
38328         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38329         route_params_conv = RouteParameters_clone(&route_params_conv);
38330         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38331         CHECK_ACCESS(retry_strategy_ptr);
38332         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38333         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38334         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
38335         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38336         return tag_ptr(ret_conv, true);
38337 }
38338
38339 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
38340         LDKChannelManager this_arg_conv;
38341         this_arg_conv.inner = untag_ptr(this_arg);
38342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38344         this_arg_conv.is_owned = false;
38345         LDKThirtyTwoBytes payment_id_ref;
38346         CHECK(payment_id->arr_len == 32);
38347         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38348         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
38349 }
38350
38351 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) {
38352         LDKChannelManager this_arg_conv;
38353         this_arg_conv.inner = untag_ptr(this_arg);
38354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38356         this_arg_conv.is_owned = false;
38357         LDKRoute route_conv;
38358         route_conv.inner = untag_ptr(route);
38359         route_conv.is_owned = ptr_is_owned(route);
38360         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38361         route_conv.is_owned = false;
38362         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38363         CHECK_ACCESS(payment_preimage_ptr);
38364         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38365         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38366         LDKRecipientOnionFields recipient_onion_conv;
38367         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38368         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38369         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38370         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38371         LDKThirtyTwoBytes payment_id_ref;
38372         CHECK(payment_id->arr_len == 32);
38373         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38374         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
38375         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
38376         return tag_ptr(ret_conv, true);
38377 }
38378
38379 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) {
38380         LDKChannelManager this_arg_conv;
38381         this_arg_conv.inner = untag_ptr(this_arg);
38382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38384         this_arg_conv.is_owned = false;
38385         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38386         CHECK_ACCESS(payment_preimage_ptr);
38387         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38388         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38389         LDKRecipientOnionFields recipient_onion_conv;
38390         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38391         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38392         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38393         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38394         LDKThirtyTwoBytes payment_id_ref;
38395         CHECK(payment_id->arr_len == 32);
38396         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38397         LDKRouteParameters route_params_conv;
38398         route_params_conv.inner = untag_ptr(route_params);
38399         route_params_conv.is_owned = ptr_is_owned(route_params);
38400         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38401         route_params_conv = RouteParameters_clone(&route_params_conv);
38402         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38403         CHECK_ACCESS(retry_strategy_ptr);
38404         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38405         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38406         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
38407         *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);
38408         return tag_ptr(ret_conv, true);
38409 }
38410
38411 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
38412         LDKChannelManager this_arg_conv;
38413         this_arg_conv.inner = untag_ptr(this_arg);
38414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38416         this_arg_conv.is_owned = false;
38417         LDKPath path_conv;
38418         path_conv.inner = untag_ptr(path);
38419         path_conv.is_owned = ptr_is_owned(path);
38420         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
38421         path_conv = Path_clone(&path_conv);
38422         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
38423         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
38424         return tag_ptr(ret_conv, true);
38425 }
38426
38427 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) {
38428         LDKChannelManager this_arg_conv;
38429         this_arg_conv.inner = untag_ptr(this_arg);
38430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38432         this_arg_conv.is_owned = false;
38433         LDKPublicKey node_id_ref;
38434         CHECK(node_id->arr_len == 33);
38435         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38436         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38437         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38438         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38439         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38440         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38441         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
38442         return tag_ptr(ret_conv, true);
38443 }
38444
38445 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) {
38446         LDKChannelManager this_arg_conv;
38447         this_arg_conv.inner = untag_ptr(this_arg);
38448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38450         this_arg_conv.is_owned = false;
38451         LDKRouteParameters route_params_conv;
38452         route_params_conv.inner = untag_ptr(route_params);
38453         route_params_conv.is_owned = ptr_is_owned(route_params);
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38455         route_params_conv = RouteParameters_clone(&route_params_conv);
38456         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38457         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38458         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38459         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38460         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38461         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
38462         return tag_ptr(ret_conv, true);
38463 }
38464
38465 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) {
38466         LDKChannelManager this_arg_conv;
38467         this_arg_conv.inner = untag_ptr(this_arg);
38468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38470         this_arg_conv.is_owned = false;
38471         uint8_t temporary_channel_id_arr[32];
38472         CHECK(temporary_channel_id->arr_len == 32);
38473         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38474         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38475         LDKPublicKey counterparty_node_id_ref;
38476         CHECK(counterparty_node_id->arr_len == 33);
38477         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38478         LDKTransaction funding_transaction_ref;
38479         funding_transaction_ref.datalen = funding_transaction->arr_len;
38480         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38481         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38482         funding_transaction_ref.data_is_owned = true;
38483         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38484         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
38485         return tag_ptr(ret_conv, true);
38486 }
38487
38488 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) {
38489         LDKChannelManager this_arg_conv;
38490         this_arg_conv.inner = untag_ptr(this_arg);
38491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38493         this_arg_conv.is_owned = false;
38494         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
38495         temporary_channels_constr.datalen = temporary_channels->arr_len;
38496         if (temporary_channels_constr.datalen > 0)
38497                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
38498         else
38499                 temporary_channels_constr.data = NULL;
38500         uint64_t* temporary_channels_vals = temporary_channels->elems;
38501         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
38502                 uint64_t temporary_channels_conv_35 = temporary_channels_vals[j];
38503                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
38504                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
38505                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
38506                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
38507                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
38508         }
38509         FREE(temporary_channels);
38510         LDKTransaction funding_transaction_ref;
38511         funding_transaction_ref.datalen = funding_transaction->arr_len;
38512         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38513         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38514         funding_transaction_ref.data_is_owned = true;
38515         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38516         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
38517         return tag_ptr(ret_conv, true);
38518 }
38519
38520 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) {
38521         LDKChannelManager this_arg_conv;
38522         this_arg_conv.inner = untag_ptr(this_arg);
38523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38525         this_arg_conv.is_owned = false;
38526         LDKPublicKey counterparty_node_id_ref;
38527         CHECK(counterparty_node_id->arr_len == 33);
38528         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38529         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38530         channel_ids_constr.datalen = channel_ids->arr_len;
38531         if (channel_ids_constr.datalen > 0)
38532                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38533         else
38534                 channel_ids_constr.data = NULL;
38535         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38536         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
38537                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
38538                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
38539                 CHECK(channel_ids_conv_12->arr_len == 32);
38540                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
38541                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
38542         }
38543         FREE(channel_ids);
38544         LDKChannelConfigUpdate config_update_conv;
38545         config_update_conv.inner = untag_ptr(config_update);
38546         config_update_conv.is_owned = ptr_is_owned(config_update);
38547         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
38548         config_update_conv.is_owned = false;
38549         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38550         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
38551         return tag_ptr(ret_conv, true);
38552 }
38553
38554 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) {
38555         LDKChannelManager this_arg_conv;
38556         this_arg_conv.inner = untag_ptr(this_arg);
38557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38559         this_arg_conv.is_owned = false;
38560         LDKPublicKey counterparty_node_id_ref;
38561         CHECK(counterparty_node_id->arr_len == 33);
38562         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38563         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38564         channel_ids_constr.datalen = channel_ids->arr_len;
38565         if (channel_ids_constr.datalen > 0)
38566                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38567         else
38568                 channel_ids_constr.data = NULL;
38569         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38570         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
38571                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
38572                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
38573                 CHECK(channel_ids_conv_12->arr_len == 32);
38574                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
38575                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
38576         }
38577         FREE(channel_ids);
38578         LDKChannelConfig config_conv;
38579         config_conv.inner = untag_ptr(config);
38580         config_conv.is_owned = ptr_is_owned(config);
38581         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38582         config_conv.is_owned = false;
38583         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38584         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
38585         return tag_ptr(ret_conv, true);
38586 }
38587
38588 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) {
38589         LDKChannelManager this_arg_conv;
38590         this_arg_conv.inner = untag_ptr(this_arg);
38591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38593         this_arg_conv.is_owned = false;
38594         LDKThirtyTwoBytes intercept_id_ref;
38595         CHECK(intercept_id->arr_len == 32);
38596         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
38597         uint8_t next_hop_channel_id_arr[32];
38598         CHECK(next_hop_channel_id->arr_len == 32);
38599         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
38600         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
38601         LDKPublicKey next_node_id_ref;
38602         CHECK(next_node_id->arr_len == 33);
38603         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
38604         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38605         *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);
38606         return tag_ptr(ret_conv, true);
38607 }
38608
38609 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
38610         LDKChannelManager this_arg_conv;
38611         this_arg_conv.inner = untag_ptr(this_arg);
38612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38614         this_arg_conv.is_owned = false;
38615         LDKThirtyTwoBytes intercept_id_ref;
38616         CHECK(intercept_id->arr_len == 32);
38617         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
38618         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38619         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
38620         return tag_ptr(ret_conv, true);
38621 }
38622
38623 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
38624         LDKChannelManager this_arg_conv;
38625         this_arg_conv.inner = untag_ptr(this_arg);
38626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38628         this_arg_conv.is_owned = false;
38629         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
38630 }
38631
38632 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
38633         LDKChannelManager this_arg_conv;
38634         this_arg_conv.inner = untag_ptr(this_arg);
38635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38637         this_arg_conv.is_owned = false;
38638         ChannelManager_timer_tick_occurred(&this_arg_conv);
38639 }
38640
38641 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
38642         LDKChannelManager this_arg_conv;
38643         this_arg_conv.inner = untag_ptr(this_arg);
38644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38646         this_arg_conv.is_owned = false;
38647         uint8_t payment_hash_arr[32];
38648         CHECK(payment_hash->arr_len == 32);
38649         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
38650         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38651         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
38652 }
38653
38654 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) {
38655         LDKChannelManager this_arg_conv;
38656         this_arg_conv.inner = untag_ptr(this_arg);
38657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38659         this_arg_conv.is_owned = false;
38660         uint8_t payment_hash_arr[32];
38661         CHECK(payment_hash->arr_len == 32);
38662         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
38663         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38664         void* failure_code_ptr = untag_ptr(failure_code);
38665         CHECK_ACCESS(failure_code_ptr);
38666         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
38667         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
38668         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
38669 }
38670
38671 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
38672         LDKChannelManager this_arg_conv;
38673         this_arg_conv.inner = untag_ptr(this_arg);
38674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38676         this_arg_conv.is_owned = false;
38677         LDKThirtyTwoBytes payment_preimage_ref;
38678         CHECK(payment_preimage->arr_len == 32);
38679         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
38680         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
38681 }
38682
38683 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) {
38684         LDKChannelManager this_arg_conv;
38685         this_arg_conv.inner = untag_ptr(this_arg);
38686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38688         this_arg_conv.is_owned = false;
38689         LDKThirtyTwoBytes payment_preimage_ref;
38690         CHECK(payment_preimage->arr_len == 32);
38691         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
38692         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
38693 }
38694
38695 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
38696         LDKChannelManager this_arg_conv;
38697         this_arg_conv.inner = untag_ptr(this_arg);
38698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38700         this_arg_conv.is_owned = false;
38701         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38702         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
38703         return ret_arr;
38704 }
38705
38706 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) {
38707         LDKChannelManager this_arg_conv;
38708         this_arg_conv.inner = untag_ptr(this_arg);
38709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38711         this_arg_conv.is_owned = false;
38712         uint8_t temporary_channel_id_arr[32];
38713         CHECK(temporary_channel_id->arr_len == 32);
38714         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38715         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38716         LDKPublicKey counterparty_node_id_ref;
38717         CHECK(counterparty_node_id->arr_len == 33);
38718         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38719         LDKU128 user_channel_id_ref;
38720         CHECK(user_channel_id->arr_len == 16);
38721         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38722         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38723         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
38724         return tag_ptr(ret_conv, true);
38725 }
38726
38727 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) {
38728         LDKChannelManager this_arg_conv;
38729         this_arg_conv.inner = untag_ptr(this_arg);
38730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38732         this_arg_conv.is_owned = false;
38733         uint8_t temporary_channel_id_arr[32];
38734         CHECK(temporary_channel_id->arr_len == 32);
38735         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38736         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38737         LDKPublicKey counterparty_node_id_ref;
38738         CHECK(counterparty_node_id->arr_len == 33);
38739         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38740         LDKU128 user_channel_id_ref;
38741         CHECK(user_channel_id->arr_len == 16);
38742         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38743         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38744         *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);
38745         return tag_ptr(ret_conv, true);
38746 }
38747
38748 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) {
38749         LDKChannelManager this_arg_conv;
38750         this_arg_conv.inner = untag_ptr(this_arg);
38751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38753         this_arg_conv.is_owned = false;
38754         LDKOffer offer_conv;
38755         offer_conv.inner = untag_ptr(offer);
38756         offer_conv.is_owned = ptr_is_owned(offer);
38757         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
38758         offer_conv.is_owned = false;
38759         void* quantity_ptr = untag_ptr(quantity);
38760         CHECK_ACCESS(quantity_ptr);
38761         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
38762         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
38763         void* amount_msats_ptr = untag_ptr(amount_msats);
38764         CHECK_ACCESS(amount_msats_ptr);
38765         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
38766         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
38767         void* payer_note_ptr = untag_ptr(payer_note);
38768         CHECK_ACCESS(payer_note_ptr);
38769         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
38770         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
38771         LDKThirtyTwoBytes payment_id_ref;
38772         CHECK(payment_id->arr_len == 32);
38773         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38774         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38775         CHECK_ACCESS(retry_strategy_ptr);
38776         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38777         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38778         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
38779         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
38780         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
38781         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
38782         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
38783         *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);
38784         return tag_ptr(ret_conv, true);
38785 }
38786
38787 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
38788         LDKChannelManager this_arg_conv;
38789         this_arg_conv.inner = untag_ptr(this_arg);
38790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38792         this_arg_conv.is_owned = false;
38793         LDKRefund refund_conv;
38794         refund_conv.inner = untag_ptr(refund);
38795         refund_conv.is_owned = ptr_is_owned(refund);
38796         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
38797         refund_conv.is_owned = false;
38798         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
38799         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
38800         return tag_ptr(ret_conv, true);
38801 }
38802
38803 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) {
38804         LDKChannelManager this_arg_conv;
38805         this_arg_conv.inner = untag_ptr(this_arg);
38806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38808         this_arg_conv.is_owned = false;
38809         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38810         CHECK_ACCESS(min_value_msat_ptr);
38811         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38812         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38813         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
38814         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
38815         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
38816         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
38817         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
38818         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
38819         return tag_ptr(ret_conv, true);
38820 }
38821
38822 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) {
38823         LDKChannelManager this_arg_conv;
38824         this_arg_conv.inner = untag_ptr(this_arg);
38825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38827         this_arg_conv.is_owned = false;
38828         LDKThirtyTwoBytes payment_hash_ref;
38829         CHECK(payment_hash->arr_len == 32);
38830         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38831         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38832         CHECK_ACCESS(min_value_msat_ptr);
38833         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38834         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38835         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
38836         CHECK_ACCESS(min_final_cltv_expiry_ptr);
38837         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
38838         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
38839         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
38840         *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);
38841         return tag_ptr(ret_conv, true);
38842 }
38843
38844 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) {
38845         LDKChannelManager this_arg_conv;
38846         this_arg_conv.inner = untag_ptr(this_arg);
38847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38849         this_arg_conv.is_owned = false;
38850         LDKThirtyTwoBytes payment_hash_ref;
38851         CHECK(payment_hash->arr_len == 32);
38852         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38853         LDKThirtyTwoBytes payment_secret_ref;
38854         CHECK(payment_secret->arr_len == 32);
38855         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
38856         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
38857         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
38858         return tag_ptr(ret_conv, true);
38859 }
38860
38861 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
38862         LDKChannelManager this_arg_conv;
38863         this_arg_conv.inner = untag_ptr(this_arg);
38864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38866         this_arg_conv.is_owned = false;
38867         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
38868         return ret_conv;
38869 }
38870
38871 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
38872         LDKChannelManager this_arg_conv;
38873         this_arg_conv.inner = untag_ptr(this_arg);
38874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38876         this_arg_conv.is_owned = false;
38877         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
38878         uint64_t ret_ref = 0;
38879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38881         return ret_ref;
38882 }
38883
38884 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
38885         LDKChannelManager this_arg_conv;
38886         this_arg_conv.inner = untag_ptr(this_arg);
38887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38889         this_arg_conv.is_owned = false;
38890         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
38891         return ret_conv;
38892 }
38893
38894 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
38895         LDKChannelManager this_arg_conv;
38896         this_arg_conv.inner = untag_ptr(this_arg);
38897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38899         this_arg_conv.is_owned = false;
38900         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
38901         uint64_t ret_ref = 0;
38902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38904         return ret_ref;
38905 }
38906
38907 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
38908         LDKChannelManager this_arg_conv;
38909         this_arg_conv.inner = untag_ptr(this_arg);
38910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38912         this_arg_conv.is_owned = false;
38913         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38914         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
38915         return tag_ptr(ret_ret, true);
38916 }
38917
38918 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
38919         LDKChannelManager this_arg_conv;
38920         this_arg_conv.inner = untag_ptr(this_arg);
38921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38923         this_arg_conv.is_owned = false;
38924         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38925         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
38926         return tag_ptr(ret_ret, true);
38927 }
38928
38929 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
38930         LDKChannelManager this_arg_conv;
38931         this_arg_conv.inner = untag_ptr(this_arg);
38932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38934         this_arg_conv.is_owned = false;
38935         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38936         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
38937         return tag_ptr(ret_ret, true);
38938 }
38939
38940 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
38941         LDKChannelManager this_arg_conv;
38942         this_arg_conv.inner = untag_ptr(this_arg);
38943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38945         this_arg_conv.is_owned = false;
38946         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38947         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
38948         return tag_ptr(ret_ret, true);
38949 }
38950
38951 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) {
38952         LDKChannelManager this_arg_conv;
38953         this_arg_conv.inner = untag_ptr(this_arg);
38954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38956         this_arg_conv.is_owned = false;
38957         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
38958         uint64_t ret_ref = 0;
38959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38961         return ret_ref;
38962 }
38963
38964 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
38965         LDKChannelManager this_arg_conv;
38966         this_arg_conv.inner = untag_ptr(this_arg);
38967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38969         this_arg_conv.is_owned = false;
38970         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
38971         return ret_conv;
38972 }
38973
38974 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
38975         LDKChannelManager this_arg_conv;
38976         this_arg_conv.inner = untag_ptr(this_arg);
38977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38979         this_arg_conv.is_owned = false;
38980         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
38981         uint64_t ret_ref = 0;
38982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38984         return ret_ref;
38985 }
38986
38987 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
38988         LDKChannelManager this_arg_conv;
38989         this_arg_conv.inner = untag_ptr(this_arg);
38990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38992         this_arg_conv.is_owned = false;
38993         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
38994         uint64_t ret_ref = 0;
38995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38997         return ret_ref;
38998 }
38999
39000 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
39001         LDKChannelManager this_arg_conv;
39002         this_arg_conv.inner = untag_ptr(this_arg);
39003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39005         this_arg_conv.is_owned = false;
39006         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
39007         uint64_t ret_ref = 0;
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39010         return ret_ref;
39011 }
39012
39013 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
39014         LDKChannelManager this_arg_conv;
39015         this_arg_conv.inner = untag_ptr(this_arg);
39016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39018         this_arg_conv.is_owned = false;
39019         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
39020         uint64_t ret_ref = 0;
39021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39023         return ret_ref;
39024 }
39025
39026 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
39027         LDKChannelManager this_arg_conv;
39028         this_arg_conv.inner = untag_ptr(this_arg);
39029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39031         this_arg_conv.is_owned = false;
39032         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
39033         uint64_t ret_ref = 0;
39034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39036         return ret_ref;
39037 }
39038
39039 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
39040         LDKChannelManager this_arg_conv;
39041         this_arg_conv.inner = untag_ptr(this_arg);
39042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39044         this_arg_conv.is_owned = false;
39045         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
39046         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
39047         return tag_ptr(ret_ret, true);
39048 }
39049
39050 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
39051         LDKChannelManager this_arg_conv;
39052         this_arg_conv.inner = untag_ptr(this_arg);
39053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39055         this_arg_conv.is_owned = false;
39056         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
39057         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
39058         return tag_ptr(ret_ret, true);
39059 }
39060
39061 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
39062         LDKUserConfig config_conv;
39063         config_conv.inner = untag_ptr(config);
39064         config_conv.is_owned = ptr_is_owned(config);
39065         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
39066         config_conv.is_owned = false;
39067         LDKInitFeatures ret_var = provided_init_features(&config_conv);
39068         uint64_t ret_ref = 0;
39069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39071         return ret_ref;
39072 }
39073
39074 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
39075         LDKCounterpartyForwardingInfo obj_conv;
39076         obj_conv.inner = untag_ptr(obj);
39077         obj_conv.is_owned = ptr_is_owned(obj);
39078         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39079         obj_conv.is_owned = false;
39080         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
39081         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39082         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39083         CVec_u8Z_free(ret_var);
39084         return ret_arr;
39085 }
39086
39087 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
39088         LDKu8slice ser_ref;
39089         ser_ref.datalen = ser->arr_len;
39090         ser_ref.data = ser->elems;
39091         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
39092         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
39093         FREE(ser);
39094         return tag_ptr(ret_conv, true);
39095 }
39096
39097 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
39098         LDKChannelCounterparty obj_conv;
39099         obj_conv.inner = untag_ptr(obj);
39100         obj_conv.is_owned = ptr_is_owned(obj);
39101         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39102         obj_conv.is_owned = false;
39103         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
39104         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39105         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39106         CVec_u8Z_free(ret_var);
39107         return ret_arr;
39108 }
39109
39110 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
39111         LDKu8slice ser_ref;
39112         ser_ref.datalen = ser->arr_len;
39113         ser_ref.data = ser->elems;
39114         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
39115         *ret_conv = ChannelCounterparty_read(ser_ref);
39116         FREE(ser);
39117         return tag_ptr(ret_conv, true);
39118 }
39119
39120 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
39121         LDKChannelDetails obj_conv;
39122         obj_conv.inner = untag_ptr(obj);
39123         obj_conv.is_owned = ptr_is_owned(obj);
39124         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39125         obj_conv.is_owned = false;
39126         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
39127         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39128         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39129         CVec_u8Z_free(ret_var);
39130         return ret_arr;
39131 }
39132
39133 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
39134         LDKu8slice ser_ref;
39135         ser_ref.datalen = ser->arr_len;
39136         ser_ref.data = ser->elems;
39137         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
39138         *ret_conv = ChannelDetails_read(ser_ref);
39139         FREE(ser);
39140         return tag_ptr(ret_conv, true);
39141 }
39142
39143 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
39144         LDKPhantomRouteHints obj_conv;
39145         obj_conv.inner = untag_ptr(obj);
39146         obj_conv.is_owned = ptr_is_owned(obj);
39147         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39148         obj_conv.is_owned = false;
39149         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
39150         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39151         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39152         CVec_u8Z_free(ret_var);
39153         return ret_arr;
39154 }
39155
39156 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
39157         LDKu8slice ser_ref;
39158         ser_ref.datalen = ser->arr_len;
39159         ser_ref.data = ser->elems;
39160         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
39161         *ret_conv = PhantomRouteHints_read(ser_ref);
39162         FREE(ser);
39163         return tag_ptr(ret_conv, true);
39164 }
39165
39166 int8_tArray  __attribute__((export_name("TS_BlindedForward_write"))) TS_BlindedForward_write(uint64_t obj) {
39167         LDKBlindedForward obj_conv;
39168         obj_conv.inner = untag_ptr(obj);
39169         obj_conv.is_owned = ptr_is_owned(obj);
39170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39171         obj_conv.is_owned = false;
39172         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
39173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39175         CVec_u8Z_free(ret_var);
39176         return ret_arr;
39177 }
39178
39179 uint64_t  __attribute__((export_name("TS_BlindedForward_read"))) TS_BlindedForward_read(int8_tArray ser) {
39180         LDKu8slice ser_ref;
39181         ser_ref.datalen = ser->arr_len;
39182         ser_ref.data = ser->elems;
39183         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
39184         *ret_conv = BlindedForward_read(ser_ref);
39185         FREE(ser);
39186         return tag_ptr(ret_conv, true);
39187 }
39188
39189 int8_tArray  __attribute__((export_name("TS_PendingHTLCRouting_write"))) TS_PendingHTLCRouting_write(uint64_t obj) {
39190         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
39191         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
39192         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39193         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39194         CVec_u8Z_free(ret_var);
39195         return ret_arr;
39196 }
39197
39198 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_read"))) TS_PendingHTLCRouting_read(int8_tArray ser) {
39199         LDKu8slice ser_ref;
39200         ser_ref.datalen = ser->arr_len;
39201         ser_ref.data = ser->elems;
39202         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
39203         *ret_conv = PendingHTLCRouting_read(ser_ref);
39204         FREE(ser);
39205         return tag_ptr(ret_conv, true);
39206 }
39207
39208 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_write"))) TS_PendingHTLCInfo_write(uint64_t obj) {
39209         LDKPendingHTLCInfo obj_conv;
39210         obj_conv.inner = untag_ptr(obj);
39211         obj_conv.is_owned = ptr_is_owned(obj);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39213         obj_conv.is_owned = false;
39214         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
39215         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39216         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39217         CVec_u8Z_free(ret_var);
39218         return ret_arr;
39219 }
39220
39221 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_read"))) TS_PendingHTLCInfo_read(int8_tArray ser) {
39222         LDKu8slice ser_ref;
39223         ser_ref.datalen = ser->arr_len;
39224         ser_ref.data = ser->elems;
39225         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
39226         *ret_conv = PendingHTLCInfo_read(ser_ref);
39227         FREE(ser);
39228         return tag_ptr(ret_conv, true);
39229 }
39230
39231 int8_tArray  __attribute__((export_name("TS_BlindedFailure_write"))) TS_BlindedFailure_write(uint64_t obj) {
39232         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
39233         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
39234         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39235         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39236         CVec_u8Z_free(ret_var);
39237         return ret_arr;
39238 }
39239
39240 uint64_t  __attribute__((export_name("TS_BlindedFailure_read"))) TS_BlindedFailure_read(int8_tArray ser) {
39241         LDKu8slice ser_ref;
39242         ser_ref.datalen = ser->arr_len;
39243         ser_ref.data = ser->elems;
39244         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
39245         *ret_conv = BlindedFailure_read(ser_ref);
39246         FREE(ser);
39247         return tag_ptr(ret_conv, true);
39248 }
39249
39250 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
39251         LDKChannelManager obj_conv;
39252         obj_conv.inner = untag_ptr(obj);
39253         obj_conv.is_owned = ptr_is_owned(obj);
39254         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39255         obj_conv.is_owned = false;
39256         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
39257         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39258         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39259         CVec_u8Z_free(ret_var);
39260         return ret_arr;
39261 }
39262
39263 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
39264         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
39265         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
39266         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39267         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39268         CVec_u8Z_free(ret_var);
39269         return ret_arr;
39270 }
39271
39272 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
39273         LDKu8slice ser_ref;
39274         ser_ref.datalen = ser->arr_len;
39275         ser_ref.data = ser->elems;
39276         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
39277         *ret_conv = ChannelShutdownState_read(ser_ref);
39278         FREE(ser);
39279         return tag_ptr(ret_conv, true);
39280 }
39281
39282 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
39283         LDKChannelManagerReadArgs this_obj_conv;
39284         this_obj_conv.inner = untag_ptr(this_obj);
39285         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39287         ChannelManagerReadArgs_free(this_obj_conv);
39288 }
39289
39290 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
39291         LDKChannelManagerReadArgs this_ptr_conv;
39292         this_ptr_conv.inner = untag_ptr(this_ptr);
39293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39295         this_ptr_conv.is_owned = false;
39296         // WARNING: This object doesn't live past this scope, needs clone!
39297         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
39298         return ret_ret;
39299 }
39300
39301 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
39302         LDKChannelManagerReadArgs this_ptr_conv;
39303         this_ptr_conv.inner = untag_ptr(this_ptr);
39304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39306         this_ptr_conv.is_owned = false;
39307         void* val_ptr = untag_ptr(val);
39308         CHECK_ACCESS(val_ptr);
39309         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
39310         if (val_conv.free == LDKEntropySource_JCalls_free) {
39311                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39312                 LDKEntropySource_JCalls_cloned(&val_conv);
39313         }
39314         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
39315 }
39316
39317 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
39318         LDKChannelManagerReadArgs this_ptr_conv;
39319         this_ptr_conv.inner = untag_ptr(this_ptr);
39320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39322         this_ptr_conv.is_owned = false;
39323         // WARNING: This object doesn't live past this scope, needs clone!
39324         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
39325         return ret_ret;
39326 }
39327
39328 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
39329         LDKChannelManagerReadArgs this_ptr_conv;
39330         this_ptr_conv.inner = untag_ptr(this_ptr);
39331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39333         this_ptr_conv.is_owned = false;
39334         void* val_ptr = untag_ptr(val);
39335         CHECK_ACCESS(val_ptr);
39336         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
39337         if (val_conv.free == LDKNodeSigner_JCalls_free) {
39338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39339                 LDKNodeSigner_JCalls_cloned(&val_conv);
39340         }
39341         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
39342 }
39343
39344 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
39345         LDKChannelManagerReadArgs this_ptr_conv;
39346         this_ptr_conv.inner = untag_ptr(this_ptr);
39347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39349         this_ptr_conv.is_owned = false;
39350         // WARNING: This object doesn't live past this scope, needs clone!
39351         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
39352         return ret_ret;
39353 }
39354
39355 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
39356         LDKChannelManagerReadArgs this_ptr_conv;
39357         this_ptr_conv.inner = untag_ptr(this_ptr);
39358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39360         this_ptr_conv.is_owned = false;
39361         void* val_ptr = untag_ptr(val);
39362         CHECK_ACCESS(val_ptr);
39363         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
39364         if (val_conv.free == LDKSignerProvider_JCalls_free) {
39365                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39366                 LDKSignerProvider_JCalls_cloned(&val_conv);
39367         }
39368         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
39369 }
39370
39371 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
39372         LDKChannelManagerReadArgs this_ptr_conv;
39373         this_ptr_conv.inner = untag_ptr(this_ptr);
39374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39376         this_ptr_conv.is_owned = false;
39377         // WARNING: This object doesn't live past this scope, needs clone!
39378         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
39379         return ret_ret;
39380 }
39381
39382 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
39383         LDKChannelManagerReadArgs this_ptr_conv;
39384         this_ptr_conv.inner = untag_ptr(this_ptr);
39385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39387         this_ptr_conv.is_owned = false;
39388         void* val_ptr = untag_ptr(val);
39389         CHECK_ACCESS(val_ptr);
39390         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
39391         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
39392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39393                 LDKFeeEstimator_JCalls_cloned(&val_conv);
39394         }
39395         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
39396 }
39397
39398 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
39399         LDKChannelManagerReadArgs this_ptr_conv;
39400         this_ptr_conv.inner = untag_ptr(this_ptr);
39401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39403         this_ptr_conv.is_owned = false;
39404         // WARNING: This object doesn't live past this scope, needs clone!
39405         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
39406         return ret_ret;
39407 }
39408
39409 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
39410         LDKChannelManagerReadArgs this_ptr_conv;
39411         this_ptr_conv.inner = untag_ptr(this_ptr);
39412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39414         this_ptr_conv.is_owned = false;
39415         void* val_ptr = untag_ptr(val);
39416         CHECK_ACCESS(val_ptr);
39417         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
39418         if (val_conv.free == LDKWatch_JCalls_free) {
39419                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39420                 LDKWatch_JCalls_cloned(&val_conv);
39421         }
39422         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
39423 }
39424
39425 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
39426         LDKChannelManagerReadArgs this_ptr_conv;
39427         this_ptr_conv.inner = untag_ptr(this_ptr);
39428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39430         this_ptr_conv.is_owned = false;
39431         // WARNING: This object doesn't live past this scope, needs clone!
39432         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
39433         return ret_ret;
39434 }
39435
39436 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
39437         LDKChannelManagerReadArgs this_ptr_conv;
39438         this_ptr_conv.inner = untag_ptr(this_ptr);
39439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39441         this_ptr_conv.is_owned = false;
39442         void* val_ptr = untag_ptr(val);
39443         CHECK_ACCESS(val_ptr);
39444         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
39445         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
39446                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39447                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
39448         }
39449         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
39450 }
39451
39452 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
39453         LDKChannelManagerReadArgs this_ptr_conv;
39454         this_ptr_conv.inner = untag_ptr(this_ptr);
39455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39457         this_ptr_conv.is_owned = false;
39458         // WARNING: This object doesn't live past this scope, needs clone!
39459         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
39460         return ret_ret;
39461 }
39462
39463 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
39464         LDKChannelManagerReadArgs this_ptr_conv;
39465         this_ptr_conv.inner = untag_ptr(this_ptr);
39466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39468         this_ptr_conv.is_owned = false;
39469         void* val_ptr = untag_ptr(val);
39470         CHECK_ACCESS(val_ptr);
39471         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
39472         if (val_conv.free == LDKRouter_JCalls_free) {
39473                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39474                 LDKRouter_JCalls_cloned(&val_conv);
39475         }
39476         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
39477 }
39478
39479 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
39480         LDKChannelManagerReadArgs this_ptr_conv;
39481         this_ptr_conv.inner = untag_ptr(this_ptr);
39482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39484         this_ptr_conv.is_owned = false;
39485         // WARNING: This object doesn't live past this scope, needs clone!
39486         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
39487         return ret_ret;
39488 }
39489
39490 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
39491         LDKChannelManagerReadArgs this_ptr_conv;
39492         this_ptr_conv.inner = untag_ptr(this_ptr);
39493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39495         this_ptr_conv.is_owned = false;
39496         void* val_ptr = untag_ptr(val);
39497         CHECK_ACCESS(val_ptr);
39498         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
39499         if (val_conv.free == LDKLogger_JCalls_free) {
39500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39501                 LDKLogger_JCalls_cloned(&val_conv);
39502         }
39503         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
39504 }
39505
39506 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
39507         LDKChannelManagerReadArgs this_ptr_conv;
39508         this_ptr_conv.inner = untag_ptr(this_ptr);
39509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39511         this_ptr_conv.is_owned = false;
39512         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
39513         uint64_t ret_ref = 0;
39514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39516         return ret_ref;
39517 }
39518
39519 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
39520         LDKChannelManagerReadArgs this_ptr_conv;
39521         this_ptr_conv.inner = untag_ptr(this_ptr);
39522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39524         this_ptr_conv.is_owned = false;
39525         LDKUserConfig val_conv;
39526         val_conv.inner = untag_ptr(val);
39527         val_conv.is_owned = ptr_is_owned(val);
39528         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39529         val_conv = UserConfig_clone(&val_conv);
39530         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
39531 }
39532
39533 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) {
39534         void* entropy_source_ptr = untag_ptr(entropy_source);
39535         CHECK_ACCESS(entropy_source_ptr);
39536         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
39537         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
39538                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39539                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
39540         }
39541         void* node_signer_ptr = untag_ptr(node_signer);
39542         CHECK_ACCESS(node_signer_ptr);
39543         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
39544         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
39545                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39546                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
39547         }
39548         void* signer_provider_ptr = untag_ptr(signer_provider);
39549         CHECK_ACCESS(signer_provider_ptr);
39550         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
39551         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
39552                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39553                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
39554         }
39555         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39556         CHECK_ACCESS(fee_estimator_ptr);
39557         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39558         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39559                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39560                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39561         }
39562         void* chain_monitor_ptr = untag_ptr(chain_monitor);
39563         CHECK_ACCESS(chain_monitor_ptr);
39564         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
39565         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
39566                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39567                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
39568         }
39569         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
39570         CHECK_ACCESS(tx_broadcaster_ptr);
39571         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
39572         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39573                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39574                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
39575         }
39576         void* router_ptr = untag_ptr(router);
39577         CHECK_ACCESS(router_ptr);
39578         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
39579         if (router_conv.free == LDKRouter_JCalls_free) {
39580                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39581                 LDKRouter_JCalls_cloned(&router_conv);
39582         }
39583         void* logger_ptr = untag_ptr(logger);
39584         CHECK_ACCESS(logger_ptr);
39585         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39586         if (logger_conv.free == LDKLogger_JCalls_free) {
39587                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39588                 LDKLogger_JCalls_cloned(&logger_conv);
39589         }
39590         LDKUserConfig default_config_conv;
39591         default_config_conv.inner = untag_ptr(default_config);
39592         default_config_conv.is_owned = ptr_is_owned(default_config);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
39594         default_config_conv = UserConfig_clone(&default_config_conv);
39595         LDKCVec_ChannelMonitorZ channel_monitors_constr;
39596         channel_monitors_constr.datalen = channel_monitors->arr_len;
39597         if (channel_monitors_constr.datalen > 0)
39598                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
39599         else
39600                 channel_monitors_constr.data = NULL;
39601         uint64_t* channel_monitors_vals = channel_monitors->elems;
39602         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
39603                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
39604                 LDKChannelMonitor channel_monitors_conv_16_conv;
39605                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
39606                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
39607                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
39608                 channel_monitors_conv_16_conv.is_owned = false;
39609                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
39610         }
39611         FREE(channel_monitors);
39612         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);
39613         uint64_t ret_ref = 0;
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39616         return ret_ref;
39617 }
39618
39619 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
39620         LDKu8slice ser_ref;
39621         ser_ref.datalen = ser->arr_len;
39622         ser_ref.data = ser->elems;
39623         LDKChannelManagerReadArgs arg_conv;
39624         arg_conv.inner = untag_ptr(arg);
39625         arg_conv.is_owned = ptr_is_owned(arg);
39626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39627         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
39628         
39629         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
39630         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
39631         FREE(ser);
39632         return tag_ptr(ret_conv, true);
39633 }
39634
39635 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_free"))) TS_DelayedPaymentBasepoint_free(uint64_t this_obj) {
39636         LDKDelayedPaymentBasepoint this_obj_conv;
39637         this_obj_conv.inner = untag_ptr(this_obj);
39638         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39640         DelayedPaymentBasepoint_free(this_obj_conv);
39641 }
39642
39643 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_get_a"))) TS_DelayedPaymentBasepoint_get_a(uint64_t this_ptr) {
39644         LDKDelayedPaymentBasepoint this_ptr_conv;
39645         this_ptr_conv.inner = untag_ptr(this_ptr);
39646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39648         this_ptr_conv.is_owned = false;
39649         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39650         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
39651         return ret_arr;
39652 }
39653
39654 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_set_a"))) TS_DelayedPaymentBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
39655         LDKDelayedPaymentBasepoint this_ptr_conv;
39656         this_ptr_conv.inner = untag_ptr(this_ptr);
39657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39659         this_ptr_conv.is_owned = false;
39660         LDKPublicKey val_ref;
39661         CHECK(val->arr_len == 33);
39662         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39663         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
39664 }
39665
39666 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_new"))) TS_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
39667         LDKPublicKey a_arg_ref;
39668         CHECK(a_arg->arr_len == 33);
39669         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39670         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
39671         uint64_t ret_ref = 0;
39672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39674         return ret_ref;
39675 }
39676
39677 jboolean  __attribute__((export_name("TS_DelayedPaymentBasepoint_eq"))) TS_DelayedPaymentBasepoint_eq(uint64_t a, uint64_t b) {
39678         LDKDelayedPaymentBasepoint a_conv;
39679         a_conv.inner = untag_ptr(a);
39680         a_conv.is_owned = ptr_is_owned(a);
39681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39682         a_conv.is_owned = false;
39683         LDKDelayedPaymentBasepoint b_conv;
39684         b_conv.inner = untag_ptr(b);
39685         b_conv.is_owned = ptr_is_owned(b);
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39687         b_conv.is_owned = false;
39688         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
39689         return ret_conv;
39690 }
39691
39692 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
39693         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
39694         uint64_t ret_ref = 0;
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39697         return ret_ref;
39698 }
39699 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone_ptr"))) TS_DelayedPaymentBasepoint_clone_ptr(uint64_t arg) {
39700         LDKDelayedPaymentBasepoint arg_conv;
39701         arg_conv.inner = untag_ptr(arg);
39702         arg_conv.is_owned = ptr_is_owned(arg);
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39704         arg_conv.is_owned = false;
39705         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
39706         return ret_conv;
39707 }
39708
39709 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone"))) TS_DelayedPaymentBasepoint_clone(uint64_t orig) {
39710         LDKDelayedPaymentBasepoint orig_conv;
39711         orig_conv.inner = untag_ptr(orig);
39712         orig_conv.is_owned = ptr_is_owned(orig);
39713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39714         orig_conv.is_owned = false;
39715         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
39716         uint64_t ret_ref = 0;
39717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39719         return ret_ref;
39720 }
39721
39722 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_hash"))) TS_DelayedPaymentBasepoint_hash(uint64_t o) {
39723         LDKDelayedPaymentBasepoint o_conv;
39724         o_conv.inner = untag_ptr(o);
39725         o_conv.is_owned = ptr_is_owned(o);
39726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39727         o_conv.is_owned = false;
39728         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
39729         return ret_conv;
39730 }
39731
39732 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_to_public_key"))) TS_DelayedPaymentBasepoint_to_public_key(uint64_t this_arg) {
39733         LDKDelayedPaymentBasepoint this_arg_conv;
39734         this_arg_conv.inner = untag_ptr(this_arg);
39735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39737         this_arg_conv.is_owned = false;
39738         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39739         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
39740         return ret_arr;
39741 }
39742
39743 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_write"))) TS_DelayedPaymentBasepoint_write(uint64_t obj) {
39744         LDKDelayedPaymentBasepoint obj_conv;
39745         obj_conv.inner = untag_ptr(obj);
39746         obj_conv.is_owned = ptr_is_owned(obj);
39747         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39748         obj_conv.is_owned = false;
39749         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
39750         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39751         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39752         CVec_u8Z_free(ret_var);
39753         return ret_arr;
39754 }
39755
39756 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_read"))) TS_DelayedPaymentBasepoint_read(int8_tArray ser) {
39757         LDKu8slice ser_ref;
39758         ser_ref.datalen = ser->arr_len;
39759         ser_ref.data = ser->elems;
39760         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
39761         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
39762         FREE(ser);
39763         return tag_ptr(ret_conv, true);
39764 }
39765
39766 void  __attribute__((export_name("TS_DelayedPaymentKey_free"))) TS_DelayedPaymentKey_free(uint64_t this_obj) {
39767         LDKDelayedPaymentKey this_obj_conv;
39768         this_obj_conv.inner = untag_ptr(this_obj);
39769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39771         DelayedPaymentKey_free(this_obj_conv);
39772 }
39773
39774 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_get_a"))) TS_DelayedPaymentKey_get_a(uint64_t this_ptr) {
39775         LDKDelayedPaymentKey this_ptr_conv;
39776         this_ptr_conv.inner = untag_ptr(this_ptr);
39777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39779         this_ptr_conv.is_owned = false;
39780         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39781         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
39782         return ret_arr;
39783 }
39784
39785 void  __attribute__((export_name("TS_DelayedPaymentKey_set_a"))) TS_DelayedPaymentKey_set_a(uint64_t this_ptr, int8_tArray val) {
39786         LDKDelayedPaymentKey this_ptr_conv;
39787         this_ptr_conv.inner = untag_ptr(this_ptr);
39788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39790         this_ptr_conv.is_owned = false;
39791         LDKPublicKey val_ref;
39792         CHECK(val->arr_len == 33);
39793         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39794         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
39795 }
39796
39797 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_new"))) TS_DelayedPaymentKey_new(int8_tArray a_arg) {
39798         LDKPublicKey a_arg_ref;
39799         CHECK(a_arg->arr_len == 33);
39800         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39801         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
39802         uint64_t ret_ref = 0;
39803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39805         return ret_ref;
39806 }
39807
39808 jboolean  __attribute__((export_name("TS_DelayedPaymentKey_eq"))) TS_DelayedPaymentKey_eq(uint64_t a, uint64_t b) {
39809         LDKDelayedPaymentKey a_conv;
39810         a_conv.inner = untag_ptr(a);
39811         a_conv.is_owned = ptr_is_owned(a);
39812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39813         a_conv.is_owned = false;
39814         LDKDelayedPaymentKey b_conv;
39815         b_conv.inner = untag_ptr(b);
39816         b_conv.is_owned = ptr_is_owned(b);
39817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39818         b_conv.is_owned = false;
39819         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
39820         return ret_conv;
39821 }
39822
39823 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
39824         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
39825         uint64_t ret_ref = 0;
39826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39828         return ret_ref;
39829 }
39830 int64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone_ptr"))) TS_DelayedPaymentKey_clone_ptr(uint64_t arg) {
39831         LDKDelayedPaymentKey arg_conv;
39832         arg_conv.inner = untag_ptr(arg);
39833         arg_conv.is_owned = ptr_is_owned(arg);
39834         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39835         arg_conv.is_owned = false;
39836         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
39837         return ret_conv;
39838 }
39839
39840 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone"))) TS_DelayedPaymentKey_clone(uint64_t orig) {
39841         LDKDelayedPaymentKey orig_conv;
39842         orig_conv.inner = untag_ptr(orig);
39843         orig_conv.is_owned = ptr_is_owned(orig);
39844         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39845         orig_conv.is_owned = false;
39846         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
39847         uint64_t ret_ref = 0;
39848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39850         return ret_ref;
39851 }
39852
39853 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_basepoint"))) TS_DelayedPaymentKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
39854         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
39855         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
39856         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
39858         countersignatory_basepoint_conv.is_owned = false;
39859         LDKPublicKey per_commitment_point_ref;
39860         CHECK(per_commitment_point->arr_len == 33);
39861         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
39862         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
39863         uint64_t ret_ref = 0;
39864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39866         return ret_ref;
39867 }
39868
39869 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_secret_key"))) TS_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
39870         uint8_t sk_arr[32];
39871         CHECK(sk->arr_len == 32);
39872         memcpy(sk_arr, sk->elems, 32); FREE(sk);
39873         uint8_t (*sk_ref)[32] = &sk_arr;
39874         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
39875         uint64_t ret_ref = 0;
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39878         return ret_ref;
39879 }
39880
39881 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_to_public_key"))) TS_DelayedPaymentKey_to_public_key(uint64_t this_arg) {
39882         LDKDelayedPaymentKey this_arg_conv;
39883         this_arg_conv.inner = untag_ptr(this_arg);
39884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39886         this_arg_conv.is_owned = false;
39887         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39888         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
39889         return ret_arr;
39890 }
39891
39892 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_write"))) TS_DelayedPaymentKey_write(uint64_t obj) {
39893         LDKDelayedPaymentKey obj_conv;
39894         obj_conv.inner = untag_ptr(obj);
39895         obj_conv.is_owned = ptr_is_owned(obj);
39896         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39897         obj_conv.is_owned = false;
39898         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
39899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39901         CVec_u8Z_free(ret_var);
39902         return ret_arr;
39903 }
39904
39905 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_read"))) TS_DelayedPaymentKey_read(int8_tArray ser) {
39906         LDKu8slice ser_ref;
39907         ser_ref.datalen = ser->arr_len;
39908         ser_ref.data = ser->elems;
39909         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
39910         *ret_conv = DelayedPaymentKey_read(ser_ref);
39911         FREE(ser);
39912         return tag_ptr(ret_conv, true);
39913 }
39914
39915 void  __attribute__((export_name("TS_HtlcBasepoint_free"))) TS_HtlcBasepoint_free(uint64_t this_obj) {
39916         LDKHtlcBasepoint this_obj_conv;
39917         this_obj_conv.inner = untag_ptr(this_obj);
39918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39920         HtlcBasepoint_free(this_obj_conv);
39921 }
39922
39923 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_get_a"))) TS_HtlcBasepoint_get_a(uint64_t this_ptr) {
39924         LDKHtlcBasepoint this_ptr_conv;
39925         this_ptr_conv.inner = untag_ptr(this_ptr);
39926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39928         this_ptr_conv.is_owned = false;
39929         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39930         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
39931         return ret_arr;
39932 }
39933
39934 void  __attribute__((export_name("TS_HtlcBasepoint_set_a"))) TS_HtlcBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
39935         LDKHtlcBasepoint this_ptr_conv;
39936         this_ptr_conv.inner = untag_ptr(this_ptr);
39937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39939         this_ptr_conv.is_owned = false;
39940         LDKPublicKey val_ref;
39941         CHECK(val->arr_len == 33);
39942         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39943         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
39944 }
39945
39946 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_new"))) TS_HtlcBasepoint_new(int8_tArray a_arg) {
39947         LDKPublicKey a_arg_ref;
39948         CHECK(a_arg->arr_len == 33);
39949         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39950         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
39951         uint64_t ret_ref = 0;
39952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39954         return ret_ref;
39955 }
39956
39957 jboolean  __attribute__((export_name("TS_HtlcBasepoint_eq"))) TS_HtlcBasepoint_eq(uint64_t a, uint64_t b) {
39958         LDKHtlcBasepoint a_conv;
39959         a_conv.inner = untag_ptr(a);
39960         a_conv.is_owned = ptr_is_owned(a);
39961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39962         a_conv.is_owned = false;
39963         LDKHtlcBasepoint b_conv;
39964         b_conv.inner = untag_ptr(b);
39965         b_conv.is_owned = ptr_is_owned(b);
39966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39967         b_conv.is_owned = false;
39968         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
39969         return ret_conv;
39970 }
39971
39972 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
39973         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
39974         uint64_t ret_ref = 0;
39975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39977         return ret_ref;
39978 }
39979 int64_t  __attribute__((export_name("TS_HtlcBasepoint_clone_ptr"))) TS_HtlcBasepoint_clone_ptr(uint64_t arg) {
39980         LDKHtlcBasepoint arg_conv;
39981         arg_conv.inner = untag_ptr(arg);
39982         arg_conv.is_owned = ptr_is_owned(arg);
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39984         arg_conv.is_owned = false;
39985         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
39986         return ret_conv;
39987 }
39988
39989 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_clone"))) TS_HtlcBasepoint_clone(uint64_t orig) {
39990         LDKHtlcBasepoint orig_conv;
39991         orig_conv.inner = untag_ptr(orig);
39992         orig_conv.is_owned = ptr_is_owned(orig);
39993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39994         orig_conv.is_owned = false;
39995         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
39996         uint64_t ret_ref = 0;
39997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39999         return ret_ref;
40000 }
40001
40002 int64_t  __attribute__((export_name("TS_HtlcBasepoint_hash"))) TS_HtlcBasepoint_hash(uint64_t o) {
40003         LDKHtlcBasepoint o_conv;
40004         o_conv.inner = untag_ptr(o);
40005         o_conv.is_owned = ptr_is_owned(o);
40006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40007         o_conv.is_owned = false;
40008         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
40009         return ret_conv;
40010 }
40011
40012 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_to_public_key"))) TS_HtlcBasepoint_to_public_key(uint64_t this_arg) {
40013         LDKHtlcBasepoint this_arg_conv;
40014         this_arg_conv.inner = untag_ptr(this_arg);
40015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40017         this_arg_conv.is_owned = false;
40018         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40019         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40020         return ret_arr;
40021 }
40022
40023 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_write"))) TS_HtlcBasepoint_write(uint64_t obj) {
40024         LDKHtlcBasepoint obj_conv;
40025         obj_conv.inner = untag_ptr(obj);
40026         obj_conv.is_owned = ptr_is_owned(obj);
40027         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40028         obj_conv.is_owned = false;
40029         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
40030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40032         CVec_u8Z_free(ret_var);
40033         return ret_arr;
40034 }
40035
40036 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_read"))) TS_HtlcBasepoint_read(int8_tArray ser) {
40037         LDKu8slice ser_ref;
40038         ser_ref.datalen = ser->arr_len;
40039         ser_ref.data = ser->elems;
40040         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40041         *ret_conv = HtlcBasepoint_read(ser_ref);
40042         FREE(ser);
40043         return tag_ptr(ret_conv, true);
40044 }
40045
40046 void  __attribute__((export_name("TS_HtlcKey_free"))) TS_HtlcKey_free(uint64_t this_obj) {
40047         LDKHtlcKey this_obj_conv;
40048         this_obj_conv.inner = untag_ptr(this_obj);
40049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40051         HtlcKey_free(this_obj_conv);
40052 }
40053
40054 int8_tArray  __attribute__((export_name("TS_HtlcKey_get_a"))) TS_HtlcKey_get_a(uint64_t this_ptr) {
40055         LDKHtlcKey this_ptr_conv;
40056         this_ptr_conv.inner = untag_ptr(this_ptr);
40057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40059         this_ptr_conv.is_owned = false;
40060         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40061         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
40062         return ret_arr;
40063 }
40064
40065 void  __attribute__((export_name("TS_HtlcKey_set_a"))) TS_HtlcKey_set_a(uint64_t this_ptr, int8_tArray val) {
40066         LDKHtlcKey this_ptr_conv;
40067         this_ptr_conv.inner = untag_ptr(this_ptr);
40068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40070         this_ptr_conv.is_owned = false;
40071         LDKPublicKey val_ref;
40072         CHECK(val->arr_len == 33);
40073         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40074         HtlcKey_set_a(&this_ptr_conv, val_ref);
40075 }
40076
40077 uint64_t  __attribute__((export_name("TS_HtlcKey_new"))) TS_HtlcKey_new(int8_tArray a_arg) {
40078         LDKPublicKey a_arg_ref;
40079         CHECK(a_arg->arr_len == 33);
40080         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40081         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
40082         uint64_t ret_ref = 0;
40083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40085         return ret_ref;
40086 }
40087
40088 jboolean  __attribute__((export_name("TS_HtlcKey_eq"))) TS_HtlcKey_eq(uint64_t a, uint64_t b) {
40089         LDKHtlcKey a_conv;
40090         a_conv.inner = untag_ptr(a);
40091         a_conv.is_owned = ptr_is_owned(a);
40092         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40093         a_conv.is_owned = false;
40094         LDKHtlcKey b_conv;
40095         b_conv.inner = untag_ptr(b);
40096         b_conv.is_owned = ptr_is_owned(b);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40098         b_conv.is_owned = false;
40099         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
40100         return ret_conv;
40101 }
40102
40103 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
40104         LDKHtlcKey ret_var = HtlcKey_clone(arg);
40105         uint64_t ret_ref = 0;
40106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40108         return ret_ref;
40109 }
40110 int64_t  __attribute__((export_name("TS_HtlcKey_clone_ptr"))) TS_HtlcKey_clone_ptr(uint64_t arg) {
40111         LDKHtlcKey arg_conv;
40112         arg_conv.inner = untag_ptr(arg);
40113         arg_conv.is_owned = ptr_is_owned(arg);
40114         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40115         arg_conv.is_owned = false;
40116         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
40117         return ret_conv;
40118 }
40119
40120 uint64_t  __attribute__((export_name("TS_HtlcKey_clone"))) TS_HtlcKey_clone(uint64_t orig) {
40121         LDKHtlcKey orig_conv;
40122         orig_conv.inner = untag_ptr(orig);
40123         orig_conv.is_owned = ptr_is_owned(orig);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40125         orig_conv.is_owned = false;
40126         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
40127         uint64_t ret_ref = 0;
40128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40130         return ret_ref;
40131 }
40132
40133 uint64_t  __attribute__((export_name("TS_HtlcKey_from_basepoint"))) TS_HtlcKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40134         LDKHtlcBasepoint countersignatory_basepoint_conv;
40135         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40136         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40137         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40138         countersignatory_basepoint_conv.is_owned = false;
40139         LDKPublicKey per_commitment_point_ref;
40140         CHECK(per_commitment_point->arr_len == 33);
40141         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40142         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40143         uint64_t ret_ref = 0;
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40146         return ret_ref;
40147 }
40148
40149 uint64_t  __attribute__((export_name("TS_HtlcKey_from_secret_key"))) TS_HtlcKey_from_secret_key(int8_tArray sk) {
40150         uint8_t sk_arr[32];
40151         CHECK(sk->arr_len == 32);
40152         memcpy(sk_arr, sk->elems, 32); FREE(sk);
40153         uint8_t (*sk_ref)[32] = &sk_arr;
40154         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
40155         uint64_t ret_ref = 0;
40156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40158         return ret_ref;
40159 }
40160
40161 int8_tArray  __attribute__((export_name("TS_HtlcKey_to_public_key"))) TS_HtlcKey_to_public_key(uint64_t this_arg) {
40162         LDKHtlcKey this_arg_conv;
40163         this_arg_conv.inner = untag_ptr(this_arg);
40164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40166         this_arg_conv.is_owned = false;
40167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40168         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
40169         return ret_arr;
40170 }
40171
40172 int8_tArray  __attribute__((export_name("TS_HtlcKey_write"))) TS_HtlcKey_write(uint64_t obj) {
40173         LDKHtlcKey obj_conv;
40174         obj_conv.inner = untag_ptr(obj);
40175         obj_conv.is_owned = ptr_is_owned(obj);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40177         obj_conv.is_owned = false;
40178         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
40179         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40180         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40181         CVec_u8Z_free(ret_var);
40182         return ret_arr;
40183 }
40184
40185 uint64_t  __attribute__((export_name("TS_HtlcKey_read"))) TS_HtlcKey_read(int8_tArray ser) {
40186         LDKu8slice ser_ref;
40187         ser_ref.datalen = ser->arr_len;
40188         ser_ref.data = ser->elems;
40189         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40190         *ret_conv = HtlcKey_read(ser_ref);
40191         FREE(ser);
40192         return tag_ptr(ret_conv, true);
40193 }
40194
40195 void  __attribute__((export_name("TS_RevocationBasepoint_free"))) TS_RevocationBasepoint_free(uint64_t this_obj) {
40196         LDKRevocationBasepoint this_obj_conv;
40197         this_obj_conv.inner = untag_ptr(this_obj);
40198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40200         RevocationBasepoint_free(this_obj_conv);
40201 }
40202
40203 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_get_a"))) TS_RevocationBasepoint_get_a(uint64_t this_ptr) {
40204         LDKRevocationBasepoint this_ptr_conv;
40205         this_ptr_conv.inner = untag_ptr(this_ptr);
40206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40208         this_ptr_conv.is_owned = false;
40209         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40210         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40211         return ret_arr;
40212 }
40213
40214 void  __attribute__((export_name("TS_RevocationBasepoint_set_a"))) TS_RevocationBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
40215         LDKRevocationBasepoint this_ptr_conv;
40216         this_ptr_conv.inner = untag_ptr(this_ptr);
40217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40219         this_ptr_conv.is_owned = false;
40220         LDKPublicKey val_ref;
40221         CHECK(val->arr_len == 33);
40222         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40223         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
40224 }
40225
40226 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_new"))) TS_RevocationBasepoint_new(int8_tArray a_arg) {
40227         LDKPublicKey a_arg_ref;
40228         CHECK(a_arg->arr_len == 33);
40229         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40230         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
40231         uint64_t ret_ref = 0;
40232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40234         return ret_ref;
40235 }
40236
40237 jboolean  __attribute__((export_name("TS_RevocationBasepoint_eq"))) TS_RevocationBasepoint_eq(uint64_t a, uint64_t b) {
40238         LDKRevocationBasepoint a_conv;
40239         a_conv.inner = untag_ptr(a);
40240         a_conv.is_owned = ptr_is_owned(a);
40241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40242         a_conv.is_owned = false;
40243         LDKRevocationBasepoint b_conv;
40244         b_conv.inner = untag_ptr(b);
40245         b_conv.is_owned = ptr_is_owned(b);
40246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40247         b_conv.is_owned = false;
40248         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
40249         return ret_conv;
40250 }
40251
40252 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
40253         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
40254         uint64_t ret_ref = 0;
40255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40257         return ret_ref;
40258 }
40259 int64_t  __attribute__((export_name("TS_RevocationBasepoint_clone_ptr"))) TS_RevocationBasepoint_clone_ptr(uint64_t arg) {
40260         LDKRevocationBasepoint arg_conv;
40261         arg_conv.inner = untag_ptr(arg);
40262         arg_conv.is_owned = ptr_is_owned(arg);
40263         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40264         arg_conv.is_owned = false;
40265         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
40266         return ret_conv;
40267 }
40268
40269 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_clone"))) TS_RevocationBasepoint_clone(uint64_t orig) {
40270         LDKRevocationBasepoint orig_conv;
40271         orig_conv.inner = untag_ptr(orig);
40272         orig_conv.is_owned = ptr_is_owned(orig);
40273         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40274         orig_conv.is_owned = false;
40275         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
40276         uint64_t ret_ref = 0;
40277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40279         return ret_ref;
40280 }
40281
40282 int64_t  __attribute__((export_name("TS_RevocationBasepoint_hash"))) TS_RevocationBasepoint_hash(uint64_t o) {
40283         LDKRevocationBasepoint o_conv;
40284         o_conv.inner = untag_ptr(o);
40285         o_conv.is_owned = ptr_is_owned(o);
40286         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40287         o_conv.is_owned = false;
40288         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
40289         return ret_conv;
40290 }
40291
40292 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_to_public_key"))) TS_RevocationBasepoint_to_public_key(uint64_t this_arg) {
40293         LDKRevocationBasepoint this_arg_conv;
40294         this_arg_conv.inner = untag_ptr(this_arg);
40295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40297         this_arg_conv.is_owned = false;
40298         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40299         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40300         return ret_arr;
40301 }
40302
40303 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_write"))) TS_RevocationBasepoint_write(uint64_t obj) {
40304         LDKRevocationBasepoint obj_conv;
40305         obj_conv.inner = untag_ptr(obj);
40306         obj_conv.is_owned = ptr_is_owned(obj);
40307         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40308         obj_conv.is_owned = false;
40309         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
40310         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40311         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40312         CVec_u8Z_free(ret_var);
40313         return ret_arr;
40314 }
40315
40316 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_read"))) TS_RevocationBasepoint_read(int8_tArray ser) {
40317         LDKu8slice ser_ref;
40318         ser_ref.datalen = ser->arr_len;
40319         ser_ref.data = ser->elems;
40320         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40321         *ret_conv = RevocationBasepoint_read(ser_ref);
40322         FREE(ser);
40323         return tag_ptr(ret_conv, true);
40324 }
40325
40326 void  __attribute__((export_name("TS_RevocationKey_free"))) TS_RevocationKey_free(uint64_t this_obj) {
40327         LDKRevocationKey this_obj_conv;
40328         this_obj_conv.inner = untag_ptr(this_obj);
40329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40331         RevocationKey_free(this_obj_conv);
40332 }
40333
40334 int8_tArray  __attribute__((export_name("TS_RevocationKey_get_a"))) TS_RevocationKey_get_a(uint64_t this_ptr) {
40335         LDKRevocationKey this_ptr_conv;
40336         this_ptr_conv.inner = untag_ptr(this_ptr);
40337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40339         this_ptr_conv.is_owned = false;
40340         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40341         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
40342         return ret_arr;
40343 }
40344
40345 void  __attribute__((export_name("TS_RevocationKey_set_a"))) TS_RevocationKey_set_a(uint64_t this_ptr, int8_tArray val) {
40346         LDKRevocationKey this_ptr_conv;
40347         this_ptr_conv.inner = untag_ptr(this_ptr);
40348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40350         this_ptr_conv.is_owned = false;
40351         LDKPublicKey val_ref;
40352         CHECK(val->arr_len == 33);
40353         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40354         RevocationKey_set_a(&this_ptr_conv, val_ref);
40355 }
40356
40357 uint64_t  __attribute__((export_name("TS_RevocationKey_new"))) TS_RevocationKey_new(int8_tArray a_arg) {
40358         LDKPublicKey a_arg_ref;
40359         CHECK(a_arg->arr_len == 33);
40360         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40361         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
40362         uint64_t ret_ref = 0;
40363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40365         return ret_ref;
40366 }
40367
40368 jboolean  __attribute__((export_name("TS_RevocationKey_eq"))) TS_RevocationKey_eq(uint64_t a, uint64_t b) {
40369         LDKRevocationKey a_conv;
40370         a_conv.inner = untag_ptr(a);
40371         a_conv.is_owned = ptr_is_owned(a);
40372         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40373         a_conv.is_owned = false;
40374         LDKRevocationKey b_conv;
40375         b_conv.inner = untag_ptr(b);
40376         b_conv.is_owned = ptr_is_owned(b);
40377         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40378         b_conv.is_owned = false;
40379         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
40380         return ret_conv;
40381 }
40382
40383 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
40384         LDKRevocationKey ret_var = RevocationKey_clone(arg);
40385         uint64_t ret_ref = 0;
40386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40388         return ret_ref;
40389 }
40390 int64_t  __attribute__((export_name("TS_RevocationKey_clone_ptr"))) TS_RevocationKey_clone_ptr(uint64_t arg) {
40391         LDKRevocationKey arg_conv;
40392         arg_conv.inner = untag_ptr(arg);
40393         arg_conv.is_owned = ptr_is_owned(arg);
40394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40395         arg_conv.is_owned = false;
40396         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
40397         return ret_conv;
40398 }
40399
40400 uint64_t  __attribute__((export_name("TS_RevocationKey_clone"))) TS_RevocationKey_clone(uint64_t orig) {
40401         LDKRevocationKey orig_conv;
40402         orig_conv.inner = untag_ptr(orig);
40403         orig_conv.is_owned = ptr_is_owned(orig);
40404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40405         orig_conv.is_owned = false;
40406         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
40407         uint64_t ret_ref = 0;
40408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40410         return ret_ref;
40411 }
40412
40413 int64_t  __attribute__((export_name("TS_RevocationKey_hash"))) TS_RevocationKey_hash(uint64_t o) {
40414         LDKRevocationKey o_conv;
40415         o_conv.inner = untag_ptr(o);
40416         o_conv.is_owned = ptr_is_owned(o);
40417         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40418         o_conv.is_owned = false;
40419         int64_t ret_conv = RevocationKey_hash(&o_conv);
40420         return ret_conv;
40421 }
40422
40423 uint64_t  __attribute__((export_name("TS_RevocationKey_from_basepoint"))) TS_RevocationKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40424         LDKRevocationBasepoint countersignatory_basepoint_conv;
40425         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40426         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40427         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40428         countersignatory_basepoint_conv.is_owned = false;
40429         LDKPublicKey per_commitment_point_ref;
40430         CHECK(per_commitment_point->arr_len == 33);
40431         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40432         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
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 int8_tArray  __attribute__((export_name("TS_RevocationKey_to_public_key"))) TS_RevocationKey_to_public_key(uint64_t this_arg) {
40440         LDKRevocationKey this_arg_conv;
40441         this_arg_conv.inner = untag_ptr(this_arg);
40442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40444         this_arg_conv.is_owned = false;
40445         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40446         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
40447         return ret_arr;
40448 }
40449
40450 int8_tArray  __attribute__((export_name("TS_RevocationKey_write"))) TS_RevocationKey_write(uint64_t obj) {
40451         LDKRevocationKey obj_conv;
40452         obj_conv.inner = untag_ptr(obj);
40453         obj_conv.is_owned = ptr_is_owned(obj);
40454         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40455         obj_conv.is_owned = false;
40456         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
40457         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40458         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40459         CVec_u8Z_free(ret_var);
40460         return ret_arr;
40461 }
40462
40463 uint64_t  __attribute__((export_name("TS_RevocationKey_read"))) TS_RevocationKey_read(int8_tArray ser) {
40464         LDKu8slice ser_ref;
40465         ser_ref.datalen = ser->arr_len;
40466         ser_ref.data = ser->elems;
40467         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40468         *ret_conv = RevocationKey_read(ser_ref);
40469         FREE(ser);
40470         return tag_ptr(ret_conv, true);
40471 }
40472
40473 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
40474         LDKExpandedKey this_obj_conv;
40475         this_obj_conv.inner = untag_ptr(this_obj);
40476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40478         ExpandedKey_free(this_obj_conv);
40479 }
40480
40481 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
40482         uint8_t key_material_arr[32];
40483         CHECK(key_material->arr_len == 32);
40484         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
40485         uint8_t (*key_material_ref)[32] = &key_material_arr;
40486         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
40487         uint64_t ret_ref = 0;
40488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40490         return ret_ref;
40491 }
40492
40493 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) {
40494         LDKExpandedKey keys_conv;
40495         keys_conv.inner = untag_ptr(keys);
40496         keys_conv.is_owned = ptr_is_owned(keys);
40497         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40498         keys_conv.is_owned = false;
40499         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40500         CHECK_ACCESS(min_value_msat_ptr);
40501         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40502         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40503         void* entropy_source_ptr = untag_ptr(entropy_source);
40504         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40505         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40506         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40507         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40508         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40509         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40510         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
40511         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
40512         return tag_ptr(ret_conv, true);
40513 }
40514
40515 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) {
40516         LDKExpandedKey keys_conv;
40517         keys_conv.inner = untag_ptr(keys);
40518         keys_conv.is_owned = ptr_is_owned(keys);
40519         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40520         keys_conv.is_owned = false;
40521         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40522         CHECK_ACCESS(min_value_msat_ptr);
40523         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40524         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40525         LDKThirtyTwoBytes payment_hash_ref;
40526         CHECK(payment_hash->arr_len == 32);
40527         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
40528         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40529         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40530         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40531         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40532         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
40533         *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);
40534         return tag_ptr(ret_conv, true);
40535 }
40536
40537 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
40538         if (!ptr_is_owned(this_ptr)) return;
40539         void* this_ptr_ptr = untag_ptr(this_ptr);
40540         CHECK_ACCESS(this_ptr_ptr);
40541         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
40542         FREE(untag_ptr(this_ptr));
40543         DecodeError_free(this_ptr_conv);
40544 }
40545
40546 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
40547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40548         *ret_copy = DecodeError_clone(arg);
40549         uint64_t ret_ref = tag_ptr(ret_copy, true);
40550         return ret_ref;
40551 }
40552 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
40553         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
40554         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
40555         return ret_conv;
40556 }
40557
40558 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
40559         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
40560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40561         *ret_copy = DecodeError_clone(orig_conv);
40562         uint64_t ret_ref = tag_ptr(ret_copy, true);
40563         return ret_ref;
40564 }
40565
40566 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
40567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40568         *ret_copy = DecodeError_unknown_version();
40569         uint64_t ret_ref = tag_ptr(ret_copy, true);
40570         return ret_ref;
40571 }
40572
40573 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
40574         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40575         *ret_copy = DecodeError_unknown_required_feature();
40576         uint64_t ret_ref = tag_ptr(ret_copy, true);
40577         return ret_ref;
40578 }
40579
40580 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
40581         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40582         *ret_copy = DecodeError_invalid_value();
40583         uint64_t ret_ref = tag_ptr(ret_copy, true);
40584         return ret_ref;
40585 }
40586
40587 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
40588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40589         *ret_copy = DecodeError_short_read();
40590         uint64_t ret_ref = tag_ptr(ret_copy, true);
40591         return ret_ref;
40592 }
40593
40594 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
40595         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40596         *ret_copy = DecodeError_bad_length_descriptor();
40597         uint64_t ret_ref = tag_ptr(ret_copy, true);
40598         return ret_ref;
40599 }
40600
40601 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
40602         LDKIOError a_conv = LDKIOError_from_js(a);
40603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40604         *ret_copy = DecodeError_io(a_conv);
40605         uint64_t ret_ref = tag_ptr(ret_copy, true);
40606         return ret_ref;
40607 }
40608
40609 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
40610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40611         *ret_copy = DecodeError_unsupported_compression();
40612         uint64_t ret_ref = tag_ptr(ret_copy, true);
40613         return ret_ref;
40614 }
40615
40616 int64_t  __attribute__((export_name("TS_DecodeError_hash"))) TS_DecodeError_hash(uint64_t o) {
40617         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
40618         int64_t ret_conv = DecodeError_hash(o_conv);
40619         return ret_conv;
40620 }
40621
40622 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
40623         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
40624         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
40625         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
40626         return ret_conv;
40627 }
40628
40629 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
40630         LDKInit this_obj_conv;
40631         this_obj_conv.inner = untag_ptr(this_obj);
40632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40634         Init_free(this_obj_conv);
40635 }
40636
40637 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
40638         LDKInit this_ptr_conv;
40639         this_ptr_conv.inner = untag_ptr(this_ptr);
40640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40642         this_ptr_conv.is_owned = false;
40643         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
40644         uint64_t ret_ref = 0;
40645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40647         return ret_ref;
40648 }
40649
40650 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
40651         LDKInit this_ptr_conv;
40652         this_ptr_conv.inner = untag_ptr(this_ptr);
40653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40655         this_ptr_conv.is_owned = false;
40656         LDKInitFeatures val_conv;
40657         val_conv.inner = untag_ptr(val);
40658         val_conv.is_owned = ptr_is_owned(val);
40659         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40660         val_conv = InitFeatures_clone(&val_conv);
40661         Init_set_features(&this_ptr_conv, val_conv);
40662 }
40663
40664 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
40665         LDKInit this_ptr_conv;
40666         this_ptr_conv.inner = untag_ptr(this_ptr);
40667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40669         this_ptr_conv.is_owned = false;
40670         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
40671         *ret_copy = Init_get_networks(&this_ptr_conv);
40672         uint64_t ret_ref = tag_ptr(ret_copy, true);
40673         return ret_ref;
40674 }
40675
40676 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
40677         LDKInit this_ptr_conv;
40678         this_ptr_conv.inner = untag_ptr(this_ptr);
40679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40681         this_ptr_conv.is_owned = false;
40682         void* val_ptr = untag_ptr(val);
40683         CHECK_ACCESS(val_ptr);
40684         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
40685         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
40686         Init_set_networks(&this_ptr_conv, val_conv);
40687 }
40688
40689 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
40690         LDKInit this_ptr_conv;
40691         this_ptr_conv.inner = untag_ptr(this_ptr);
40692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40694         this_ptr_conv.is_owned = false;
40695         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
40696         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
40697         uint64_t ret_ref = tag_ptr(ret_copy, true);
40698         return ret_ref;
40699 }
40700
40701 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
40702         LDKInit 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         void* val_ptr = untag_ptr(val);
40708         CHECK_ACCESS(val_ptr);
40709         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
40710         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
40711         Init_set_remote_network_address(&this_ptr_conv, val_conv);
40712 }
40713
40714 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) {
40715         LDKInitFeatures features_arg_conv;
40716         features_arg_conv.inner = untag_ptr(features_arg);
40717         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40718         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40719         features_arg_conv = InitFeatures_clone(&features_arg_conv);
40720         void* networks_arg_ptr = untag_ptr(networks_arg);
40721         CHECK_ACCESS(networks_arg_ptr);
40722         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
40723         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
40724         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
40725         CHECK_ACCESS(remote_network_address_arg_ptr);
40726         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
40727         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
40728         uint64_t ret_ref = 0;
40729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40731         return ret_ref;
40732 }
40733
40734 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
40735         LDKInit ret_var = Init_clone(arg);
40736         uint64_t ret_ref = 0;
40737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40739         return ret_ref;
40740 }
40741 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
40742         LDKInit arg_conv;
40743         arg_conv.inner = untag_ptr(arg);
40744         arg_conv.is_owned = ptr_is_owned(arg);
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40746         arg_conv.is_owned = false;
40747         int64_t ret_conv = Init_clone_ptr(&arg_conv);
40748         return ret_conv;
40749 }
40750
40751 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
40752         LDKInit orig_conv;
40753         orig_conv.inner = untag_ptr(orig);
40754         orig_conv.is_owned = ptr_is_owned(orig);
40755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40756         orig_conv.is_owned = false;
40757         LDKInit ret_var = Init_clone(&orig_conv);
40758         uint64_t ret_ref = 0;
40759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40761         return ret_ref;
40762 }
40763
40764 int64_t  __attribute__((export_name("TS_Init_hash"))) TS_Init_hash(uint64_t o) {
40765         LDKInit o_conv;
40766         o_conv.inner = untag_ptr(o);
40767         o_conv.is_owned = ptr_is_owned(o);
40768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40769         o_conv.is_owned = false;
40770         int64_t ret_conv = Init_hash(&o_conv);
40771         return ret_conv;
40772 }
40773
40774 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
40775         LDKInit a_conv;
40776         a_conv.inner = untag_ptr(a);
40777         a_conv.is_owned = ptr_is_owned(a);
40778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40779         a_conv.is_owned = false;
40780         LDKInit b_conv;
40781         b_conv.inner = untag_ptr(b);
40782         b_conv.is_owned = ptr_is_owned(b);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40784         b_conv.is_owned = false;
40785         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
40786         return ret_conv;
40787 }
40788
40789 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
40790         LDKErrorMessage this_obj_conv;
40791         this_obj_conv.inner = untag_ptr(this_obj);
40792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40794         ErrorMessage_free(this_obj_conv);
40795 }
40796
40797 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
40798         LDKErrorMessage this_ptr_conv;
40799         this_ptr_conv.inner = untag_ptr(this_ptr);
40800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40802         this_ptr_conv.is_owned = false;
40803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40804         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
40805         return ret_arr;
40806 }
40807
40808 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40809         LDKErrorMessage this_ptr_conv;
40810         this_ptr_conv.inner = untag_ptr(this_ptr);
40811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40813         this_ptr_conv.is_owned = false;
40814         LDKThirtyTwoBytes val_ref;
40815         CHECK(val->arr_len == 32);
40816         memcpy(val_ref.data, val->elems, 32); FREE(val);
40817         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
40818 }
40819
40820 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
40821         LDKErrorMessage this_ptr_conv;
40822         this_ptr_conv.inner = untag_ptr(this_ptr);
40823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40825         this_ptr_conv.is_owned = false;
40826         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
40827         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40828         Str_free(ret_str);
40829         return ret_conv;
40830 }
40831
40832 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
40833         LDKErrorMessage this_ptr_conv;
40834         this_ptr_conv.inner = untag_ptr(this_ptr);
40835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40837         this_ptr_conv.is_owned = false;
40838         LDKStr val_conv = str_ref_to_owned_c(val);
40839         ErrorMessage_set_data(&this_ptr_conv, val_conv);
40840 }
40841
40842 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_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         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
40847         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
40848         uint64_t ret_ref = 0;
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40851         return ret_ref;
40852 }
40853
40854 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
40855         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
40856         uint64_t ret_ref = 0;
40857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40859         return ret_ref;
40860 }
40861 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
40862         LDKErrorMessage arg_conv;
40863         arg_conv.inner = untag_ptr(arg);
40864         arg_conv.is_owned = ptr_is_owned(arg);
40865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40866         arg_conv.is_owned = false;
40867         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
40868         return ret_conv;
40869 }
40870
40871 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
40872         LDKErrorMessage orig_conv;
40873         orig_conv.inner = untag_ptr(orig);
40874         orig_conv.is_owned = ptr_is_owned(orig);
40875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40876         orig_conv.is_owned = false;
40877         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
40878         uint64_t ret_ref = 0;
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40881         return ret_ref;
40882 }
40883
40884 int64_t  __attribute__((export_name("TS_ErrorMessage_hash"))) TS_ErrorMessage_hash(uint64_t o) {
40885         LDKErrorMessage o_conv;
40886         o_conv.inner = untag_ptr(o);
40887         o_conv.is_owned = ptr_is_owned(o);
40888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40889         o_conv.is_owned = false;
40890         int64_t ret_conv = ErrorMessage_hash(&o_conv);
40891         return ret_conv;
40892 }
40893
40894 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
40895         LDKErrorMessage a_conv;
40896         a_conv.inner = untag_ptr(a);
40897         a_conv.is_owned = ptr_is_owned(a);
40898         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40899         a_conv.is_owned = false;
40900         LDKErrorMessage b_conv;
40901         b_conv.inner = untag_ptr(b);
40902         b_conv.is_owned = ptr_is_owned(b);
40903         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40904         b_conv.is_owned = false;
40905         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
40906         return ret_conv;
40907 }
40908
40909 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
40910         LDKWarningMessage this_obj_conv;
40911         this_obj_conv.inner = untag_ptr(this_obj);
40912         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40914         WarningMessage_free(this_obj_conv);
40915 }
40916
40917 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
40918         LDKWarningMessage this_ptr_conv;
40919         this_ptr_conv.inner = untag_ptr(this_ptr);
40920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40922         this_ptr_conv.is_owned = false;
40923         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40924         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
40925         return ret_arr;
40926 }
40927
40928 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40929         LDKWarningMessage this_ptr_conv;
40930         this_ptr_conv.inner = untag_ptr(this_ptr);
40931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40933         this_ptr_conv.is_owned = false;
40934         LDKThirtyTwoBytes val_ref;
40935         CHECK(val->arr_len == 32);
40936         memcpy(val_ref.data, val->elems, 32); FREE(val);
40937         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
40938 }
40939
40940 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
40941         LDKWarningMessage this_ptr_conv;
40942         this_ptr_conv.inner = untag_ptr(this_ptr);
40943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40945         this_ptr_conv.is_owned = false;
40946         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
40947         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40948         Str_free(ret_str);
40949         return ret_conv;
40950 }
40951
40952 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
40953         LDKWarningMessage this_ptr_conv;
40954         this_ptr_conv.inner = untag_ptr(this_ptr);
40955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40957         this_ptr_conv.is_owned = false;
40958         LDKStr val_conv = str_ref_to_owned_c(val);
40959         WarningMessage_set_data(&this_ptr_conv, val_conv);
40960 }
40961
40962 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
40963         LDKThirtyTwoBytes channel_id_arg_ref;
40964         CHECK(channel_id_arg->arr_len == 32);
40965         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40966         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
40967         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
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 WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
40975         LDKWarningMessage ret_var = WarningMessage_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_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
40982         LDKWarningMessage 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 = WarningMessage_clone_ptr(&arg_conv);
40988         return ret_conv;
40989 }
40990
40991 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
40992         LDKWarningMessage 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         LDKWarningMessage ret_var = WarningMessage_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 int64_t  __attribute__((export_name("TS_WarningMessage_hash"))) TS_WarningMessage_hash(uint64_t o) {
41005         LDKWarningMessage o_conv;
41006         o_conv.inner = untag_ptr(o);
41007         o_conv.is_owned = ptr_is_owned(o);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41009         o_conv.is_owned = false;
41010         int64_t ret_conv = WarningMessage_hash(&o_conv);
41011         return ret_conv;
41012 }
41013
41014 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
41015         LDKWarningMessage a_conv;
41016         a_conv.inner = untag_ptr(a);
41017         a_conv.is_owned = ptr_is_owned(a);
41018         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41019         a_conv.is_owned = false;
41020         LDKWarningMessage b_conv;
41021         b_conv.inner = untag_ptr(b);
41022         b_conv.is_owned = ptr_is_owned(b);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41024         b_conv.is_owned = false;
41025         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
41026         return ret_conv;
41027 }
41028
41029 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
41030         LDKPing this_obj_conv;
41031         this_obj_conv.inner = untag_ptr(this_obj);
41032         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41034         Ping_free(this_obj_conv);
41035 }
41036
41037 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
41038         LDKPing this_ptr_conv;
41039         this_ptr_conv.inner = untag_ptr(this_ptr);
41040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41042         this_ptr_conv.is_owned = false;
41043         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
41044         return ret_conv;
41045 }
41046
41047 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
41048         LDKPing this_ptr_conv;
41049         this_ptr_conv.inner = untag_ptr(this_ptr);
41050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41052         this_ptr_conv.is_owned = false;
41053         Ping_set_ponglen(&this_ptr_conv, val);
41054 }
41055
41056 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
41057         LDKPing this_ptr_conv;
41058         this_ptr_conv.inner = untag_ptr(this_ptr);
41059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41061         this_ptr_conv.is_owned = false;
41062         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
41063         return ret_conv;
41064 }
41065
41066 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
41067         LDKPing this_ptr_conv;
41068         this_ptr_conv.inner = untag_ptr(this_ptr);
41069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41071         this_ptr_conv.is_owned = false;
41072         Ping_set_byteslen(&this_ptr_conv, val);
41073 }
41074
41075 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
41076         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
41077         uint64_t ret_ref = 0;
41078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41080         return ret_ref;
41081 }
41082
41083 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
41084         LDKPing ret_var = Ping_clone(arg);
41085         uint64_t ret_ref = 0;
41086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41088         return ret_ref;
41089 }
41090 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
41091         LDKPing arg_conv;
41092         arg_conv.inner = untag_ptr(arg);
41093         arg_conv.is_owned = ptr_is_owned(arg);
41094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41095         arg_conv.is_owned = false;
41096         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
41097         return ret_conv;
41098 }
41099
41100 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
41101         LDKPing orig_conv;
41102         orig_conv.inner = untag_ptr(orig);
41103         orig_conv.is_owned = ptr_is_owned(orig);
41104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41105         orig_conv.is_owned = false;
41106         LDKPing ret_var = Ping_clone(&orig_conv);
41107         uint64_t ret_ref = 0;
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41110         return ret_ref;
41111 }
41112
41113 int64_t  __attribute__((export_name("TS_Ping_hash"))) TS_Ping_hash(uint64_t o) {
41114         LDKPing o_conv;
41115         o_conv.inner = untag_ptr(o);
41116         o_conv.is_owned = ptr_is_owned(o);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41118         o_conv.is_owned = false;
41119         int64_t ret_conv = Ping_hash(&o_conv);
41120         return ret_conv;
41121 }
41122
41123 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
41124         LDKPing a_conv;
41125         a_conv.inner = untag_ptr(a);
41126         a_conv.is_owned = ptr_is_owned(a);
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41128         a_conv.is_owned = false;
41129         LDKPing b_conv;
41130         b_conv.inner = untag_ptr(b);
41131         b_conv.is_owned = ptr_is_owned(b);
41132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41133         b_conv.is_owned = false;
41134         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
41135         return ret_conv;
41136 }
41137
41138 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
41139         LDKPong this_obj_conv;
41140         this_obj_conv.inner = untag_ptr(this_obj);
41141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41143         Pong_free(this_obj_conv);
41144 }
41145
41146 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
41147         LDKPong this_ptr_conv;
41148         this_ptr_conv.inner = untag_ptr(this_ptr);
41149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41151         this_ptr_conv.is_owned = false;
41152         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
41153         return ret_conv;
41154 }
41155
41156 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
41157         LDKPong this_ptr_conv;
41158         this_ptr_conv.inner = untag_ptr(this_ptr);
41159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41161         this_ptr_conv.is_owned = false;
41162         Pong_set_byteslen(&this_ptr_conv, val);
41163 }
41164
41165 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
41166         LDKPong ret_var = Pong_new(byteslen_arg);
41167         uint64_t ret_ref = 0;
41168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41170         return ret_ref;
41171 }
41172
41173 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
41174         LDKPong ret_var = Pong_clone(arg);
41175         uint64_t ret_ref = 0;
41176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41178         return ret_ref;
41179 }
41180 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
41181         LDKPong arg_conv;
41182         arg_conv.inner = untag_ptr(arg);
41183         arg_conv.is_owned = ptr_is_owned(arg);
41184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41185         arg_conv.is_owned = false;
41186         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
41187         return ret_conv;
41188 }
41189
41190 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
41191         LDKPong orig_conv;
41192         orig_conv.inner = untag_ptr(orig);
41193         orig_conv.is_owned = ptr_is_owned(orig);
41194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41195         orig_conv.is_owned = false;
41196         LDKPong ret_var = Pong_clone(&orig_conv);
41197         uint64_t ret_ref = 0;
41198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41200         return ret_ref;
41201 }
41202
41203 int64_t  __attribute__((export_name("TS_Pong_hash"))) TS_Pong_hash(uint64_t o) {
41204         LDKPong o_conv;
41205         o_conv.inner = untag_ptr(o);
41206         o_conv.is_owned = ptr_is_owned(o);
41207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41208         o_conv.is_owned = false;
41209         int64_t ret_conv = Pong_hash(&o_conv);
41210         return ret_conv;
41211 }
41212
41213 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
41214         LDKPong a_conv;
41215         a_conv.inner = untag_ptr(a);
41216         a_conv.is_owned = ptr_is_owned(a);
41217         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41218         a_conv.is_owned = false;
41219         LDKPong b_conv;
41220         b_conv.inner = untag_ptr(b);
41221         b_conv.is_owned = ptr_is_owned(b);
41222         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41223         b_conv.is_owned = false;
41224         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
41225         return ret_conv;
41226 }
41227
41228 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
41229         LDKOpenChannel this_obj_conv;
41230         this_obj_conv.inner = untag_ptr(this_obj);
41231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41233         OpenChannel_free(this_obj_conv);
41234 }
41235
41236 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
41237         LDKOpenChannel this_ptr_conv;
41238         this_ptr_conv.inner = untag_ptr(this_ptr);
41239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41241         this_ptr_conv.is_owned = false;
41242         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41243         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
41244         return ret_arr;
41245 }
41246
41247 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41248         LDKOpenChannel this_ptr_conv;
41249         this_ptr_conv.inner = untag_ptr(this_ptr);
41250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41252         this_ptr_conv.is_owned = false;
41253         LDKThirtyTwoBytes val_ref;
41254         CHECK(val->arr_len == 32);
41255         memcpy(val_ref.data, val->elems, 32); FREE(val);
41256         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
41257 }
41258
41259 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
41260         LDKOpenChannel this_ptr_conv;
41261         this_ptr_conv.inner = untag_ptr(this_ptr);
41262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41264         this_ptr_conv.is_owned = false;
41265         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41266         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
41267         return ret_arr;
41268 }
41269
41270 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
41271         LDKOpenChannel this_ptr_conv;
41272         this_ptr_conv.inner = untag_ptr(this_ptr);
41273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41275         this_ptr_conv.is_owned = false;
41276         LDKThirtyTwoBytes val_ref;
41277         CHECK(val->arr_len == 32);
41278         memcpy(val_ref.data, val->elems, 32); FREE(val);
41279         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
41280 }
41281
41282 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
41283         LDKOpenChannel this_ptr_conv;
41284         this_ptr_conv.inner = untag_ptr(this_ptr);
41285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41287         this_ptr_conv.is_owned = false;
41288         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
41289         return ret_conv;
41290 }
41291
41292 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
41293         LDKOpenChannel this_ptr_conv;
41294         this_ptr_conv.inner = untag_ptr(this_ptr);
41295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41297         this_ptr_conv.is_owned = false;
41298         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
41299 }
41300
41301 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
41302         LDKOpenChannel this_ptr_conv;
41303         this_ptr_conv.inner = untag_ptr(this_ptr);
41304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41306         this_ptr_conv.is_owned = false;
41307         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
41308         return ret_conv;
41309 }
41310
41311 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
41312         LDKOpenChannel this_ptr_conv;
41313         this_ptr_conv.inner = untag_ptr(this_ptr);
41314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41316         this_ptr_conv.is_owned = false;
41317         OpenChannel_set_push_msat(&this_ptr_conv, val);
41318 }
41319
41320 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
41321         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
41327         return ret_conv;
41328 }
41329
41330 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
41331         LDKOpenChannel this_ptr_conv;
41332         this_ptr_conv.inner = untag_ptr(this_ptr);
41333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41335         this_ptr_conv.is_owned = false;
41336         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
41337 }
41338
41339 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) {
41340         LDKOpenChannel this_ptr_conv;
41341         this_ptr_conv.inner = untag_ptr(this_ptr);
41342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41344         this_ptr_conv.is_owned = false;
41345         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41346         return ret_conv;
41347 }
41348
41349 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) {
41350         LDKOpenChannel this_ptr_conv;
41351         this_ptr_conv.inner = untag_ptr(this_ptr);
41352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41354         this_ptr_conv.is_owned = false;
41355         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41356 }
41357
41358 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
41359         LDKOpenChannel this_ptr_conv;
41360         this_ptr_conv.inner = untag_ptr(this_ptr);
41361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41363         this_ptr_conv.is_owned = false;
41364         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
41365         return ret_conv;
41366 }
41367
41368 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
41369         LDKOpenChannel this_ptr_conv;
41370         this_ptr_conv.inner = untag_ptr(this_ptr);
41371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41373         this_ptr_conv.is_owned = false;
41374         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
41375 }
41376
41377 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
41378         LDKOpenChannel this_ptr_conv;
41379         this_ptr_conv.inner = untag_ptr(this_ptr);
41380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41382         this_ptr_conv.is_owned = false;
41383         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
41384         return ret_conv;
41385 }
41386
41387 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41388         LDKOpenChannel this_ptr_conv;
41389         this_ptr_conv.inner = untag_ptr(this_ptr);
41390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41392         this_ptr_conv.is_owned = false;
41393         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
41394 }
41395
41396 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
41397         LDKOpenChannel this_ptr_conv;
41398         this_ptr_conv.inner = untag_ptr(this_ptr);
41399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41401         this_ptr_conv.is_owned = false;
41402         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
41403         return ret_conv;
41404 }
41405
41406 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
41407         LDKOpenChannel 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         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
41413 }
41414
41415 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
41416         LDKOpenChannel this_ptr_conv;
41417         this_ptr_conv.inner = untag_ptr(this_ptr);
41418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41420         this_ptr_conv.is_owned = false;
41421         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
41422         return ret_conv;
41423 }
41424
41425 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
41426         LDKOpenChannel this_ptr_conv;
41427         this_ptr_conv.inner = untag_ptr(this_ptr);
41428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41430         this_ptr_conv.is_owned = false;
41431         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
41432 }
41433
41434 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
41435         LDKOpenChannel this_ptr_conv;
41436         this_ptr_conv.inner = untag_ptr(this_ptr);
41437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41439         this_ptr_conv.is_owned = false;
41440         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
41441         return ret_conv;
41442 }
41443
41444 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
41445         LDKOpenChannel this_ptr_conv;
41446         this_ptr_conv.inner = untag_ptr(this_ptr);
41447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41449         this_ptr_conv.is_owned = false;
41450         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
41451 }
41452
41453 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
41454         LDKOpenChannel this_ptr_conv;
41455         this_ptr_conv.inner = untag_ptr(this_ptr);
41456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41458         this_ptr_conv.is_owned = false;
41459         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41460         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
41461         return ret_arr;
41462 }
41463
41464 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
41465         LDKOpenChannel this_ptr_conv;
41466         this_ptr_conv.inner = untag_ptr(this_ptr);
41467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41469         this_ptr_conv.is_owned = false;
41470         LDKPublicKey val_ref;
41471         CHECK(val->arr_len == 33);
41472         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41473         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
41474 }
41475
41476 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
41477         LDKOpenChannel this_ptr_conv;
41478         this_ptr_conv.inner = untag_ptr(this_ptr);
41479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41481         this_ptr_conv.is_owned = false;
41482         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41483         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
41484         return ret_arr;
41485 }
41486
41487 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
41488         LDKOpenChannel this_ptr_conv;
41489         this_ptr_conv.inner = untag_ptr(this_ptr);
41490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41492         this_ptr_conv.is_owned = false;
41493         LDKPublicKey val_ref;
41494         CHECK(val->arr_len == 33);
41495         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41496         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
41497 }
41498
41499 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
41500         LDKOpenChannel this_ptr_conv;
41501         this_ptr_conv.inner = untag_ptr(this_ptr);
41502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41504         this_ptr_conv.is_owned = false;
41505         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41506         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
41507         return ret_arr;
41508 }
41509
41510 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
41511         LDKOpenChannel this_ptr_conv;
41512         this_ptr_conv.inner = untag_ptr(this_ptr);
41513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41515         this_ptr_conv.is_owned = false;
41516         LDKPublicKey val_ref;
41517         CHECK(val->arr_len == 33);
41518         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41519         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
41520 }
41521
41522 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
41523         LDKOpenChannel this_ptr_conv;
41524         this_ptr_conv.inner = untag_ptr(this_ptr);
41525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41527         this_ptr_conv.is_owned = false;
41528         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41529         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
41530         return ret_arr;
41531 }
41532
41533 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
41534         LDKOpenChannel this_ptr_conv;
41535         this_ptr_conv.inner = untag_ptr(this_ptr);
41536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41538         this_ptr_conv.is_owned = false;
41539         LDKPublicKey val_ref;
41540         CHECK(val->arr_len == 33);
41541         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41542         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41543 }
41544
41545 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
41546         LDKOpenChannel this_ptr_conv;
41547         this_ptr_conv.inner = untag_ptr(this_ptr);
41548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41550         this_ptr_conv.is_owned = false;
41551         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41552         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
41553         return ret_arr;
41554 }
41555
41556 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
41557         LDKOpenChannel this_ptr_conv;
41558         this_ptr_conv.inner = untag_ptr(this_ptr);
41559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41561         this_ptr_conv.is_owned = false;
41562         LDKPublicKey val_ref;
41563         CHECK(val->arr_len == 33);
41564         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41565         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
41566 }
41567
41568 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
41569         LDKOpenChannel this_ptr_conv;
41570         this_ptr_conv.inner = untag_ptr(this_ptr);
41571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41573         this_ptr_conv.is_owned = false;
41574         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41575         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41576         return ret_arr;
41577 }
41578
41579 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) {
41580         LDKOpenChannel this_ptr_conv;
41581         this_ptr_conv.inner = untag_ptr(this_ptr);
41582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41584         this_ptr_conv.is_owned = false;
41585         LDKPublicKey val_ref;
41586         CHECK(val->arr_len == 33);
41587         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41588         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41589 }
41590
41591 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
41592         LDKOpenChannel this_ptr_conv;
41593         this_ptr_conv.inner = untag_ptr(this_ptr);
41594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41596         this_ptr_conv.is_owned = false;
41597         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
41598         return ret_conv;
41599 }
41600
41601 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
41602         LDKOpenChannel this_ptr_conv;
41603         this_ptr_conv.inner = untag_ptr(this_ptr);
41604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41606         this_ptr_conv.is_owned = false;
41607         OpenChannel_set_channel_flags(&this_ptr_conv, val);
41608 }
41609
41610 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
41611         LDKOpenChannel 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
41617         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
41618         uint64_t ret_ref = tag_ptr(ret_copy, true);
41619         return ret_ref;
41620 }
41621
41622 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
41623         LDKOpenChannel this_ptr_conv;
41624         this_ptr_conv.inner = untag_ptr(this_ptr);
41625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41627         this_ptr_conv.is_owned = false;
41628         void* val_ptr = untag_ptr(val);
41629         CHECK_ACCESS(val_ptr);
41630         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
41631         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
41632         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41633 }
41634
41635 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
41636         LDKOpenChannel this_ptr_conv;
41637         this_ptr_conv.inner = untag_ptr(this_ptr);
41638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41640         this_ptr_conv.is_owned = false;
41641         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
41642         uint64_t ret_ref = 0;
41643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41645         return ret_ref;
41646 }
41647
41648 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
41649         LDKOpenChannel this_ptr_conv;
41650         this_ptr_conv.inner = untag_ptr(this_ptr);
41651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41653         this_ptr_conv.is_owned = false;
41654         LDKChannelTypeFeatures val_conv;
41655         val_conv.inner = untag_ptr(val);
41656         val_conv.is_owned = ptr_is_owned(val);
41657         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41658         val_conv = ChannelTypeFeatures_clone(&val_conv);
41659         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
41660 }
41661
41662 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) {
41663         LDKThirtyTwoBytes chain_hash_arg_ref;
41664         CHECK(chain_hash_arg->arr_len == 32);
41665         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41666         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41667         CHECK(temporary_channel_id_arg->arr_len == 32);
41668         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
41669         LDKPublicKey funding_pubkey_arg_ref;
41670         CHECK(funding_pubkey_arg->arr_len == 33);
41671         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
41672         LDKPublicKey revocation_basepoint_arg_ref;
41673         CHECK(revocation_basepoint_arg->arr_len == 33);
41674         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
41675         LDKPublicKey payment_point_arg_ref;
41676         CHECK(payment_point_arg->arr_len == 33);
41677         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
41678         LDKPublicKey delayed_payment_basepoint_arg_ref;
41679         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
41680         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
41681         LDKPublicKey htlc_basepoint_arg_ref;
41682         CHECK(htlc_basepoint_arg->arr_len == 33);
41683         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
41684         LDKPublicKey first_per_commitment_point_arg_ref;
41685         CHECK(first_per_commitment_point_arg->arr_len == 33);
41686         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
41687         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
41688         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
41689         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
41690         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
41691         LDKChannelTypeFeatures channel_type_arg_conv;
41692         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
41693         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
41694         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
41695         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
41696         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);
41697         uint64_t ret_ref = 0;
41698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41700         return ret_ref;
41701 }
41702
41703 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
41704         LDKOpenChannel ret_var = OpenChannel_clone(arg);
41705         uint64_t ret_ref = 0;
41706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41708         return ret_ref;
41709 }
41710 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
41711         LDKOpenChannel arg_conv;
41712         arg_conv.inner = untag_ptr(arg);
41713         arg_conv.is_owned = ptr_is_owned(arg);
41714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41715         arg_conv.is_owned = false;
41716         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
41717         return ret_conv;
41718 }
41719
41720 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
41721         LDKOpenChannel orig_conv;
41722         orig_conv.inner = untag_ptr(orig);
41723         orig_conv.is_owned = ptr_is_owned(orig);
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41725         orig_conv.is_owned = false;
41726         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
41727         uint64_t ret_ref = 0;
41728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41730         return ret_ref;
41731 }
41732
41733 int64_t  __attribute__((export_name("TS_OpenChannel_hash"))) TS_OpenChannel_hash(uint64_t o) {
41734         LDKOpenChannel o_conv;
41735         o_conv.inner = untag_ptr(o);
41736         o_conv.is_owned = ptr_is_owned(o);
41737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41738         o_conv.is_owned = false;
41739         int64_t ret_conv = OpenChannel_hash(&o_conv);
41740         return ret_conv;
41741 }
41742
41743 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
41744         LDKOpenChannel a_conv;
41745         a_conv.inner = untag_ptr(a);
41746         a_conv.is_owned = ptr_is_owned(a);
41747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41748         a_conv.is_owned = false;
41749         LDKOpenChannel b_conv;
41750         b_conv.inner = untag_ptr(b);
41751         b_conv.is_owned = ptr_is_owned(b);
41752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41753         b_conv.is_owned = false;
41754         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
41755         return ret_conv;
41756 }
41757
41758 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
41759         LDKOpenChannelV2 this_obj_conv;
41760         this_obj_conv.inner = untag_ptr(this_obj);
41761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41763         OpenChannelV2_free(this_obj_conv);
41764 }
41765
41766 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
41767         LDKOpenChannelV2 this_ptr_conv;
41768         this_ptr_conv.inner = untag_ptr(this_ptr);
41769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41771         this_ptr_conv.is_owned = false;
41772         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41773         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
41774         return ret_arr;
41775 }
41776
41777 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41778         LDKOpenChannelV2 this_ptr_conv;
41779         this_ptr_conv.inner = untag_ptr(this_ptr);
41780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41782         this_ptr_conv.is_owned = false;
41783         LDKThirtyTwoBytes val_ref;
41784         CHECK(val->arr_len == 32);
41785         memcpy(val_ref.data, val->elems, 32); FREE(val);
41786         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
41787 }
41788
41789 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
41790         LDKOpenChannelV2 this_ptr_conv;
41791         this_ptr_conv.inner = untag_ptr(this_ptr);
41792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41794         this_ptr_conv.is_owned = false;
41795         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41796         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
41797         return ret_arr;
41798 }
41799
41800 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
41801         LDKOpenChannelV2 this_ptr_conv;
41802         this_ptr_conv.inner = untag_ptr(this_ptr);
41803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41805         this_ptr_conv.is_owned = false;
41806         LDKThirtyTwoBytes val_ref;
41807         CHECK(val->arr_len == 32);
41808         memcpy(val_ref.data, val->elems, 32); FREE(val);
41809         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
41810 }
41811
41812 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) {
41813         LDKOpenChannelV2 this_ptr_conv;
41814         this_ptr_conv.inner = untag_ptr(this_ptr);
41815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41817         this_ptr_conv.is_owned = false;
41818         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
41819         return ret_conv;
41820 }
41821
41822 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) {
41823         LDKOpenChannelV2 this_ptr_conv;
41824         this_ptr_conv.inner = untag_ptr(this_ptr);
41825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41827         this_ptr_conv.is_owned = false;
41828         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
41829 }
41830
41831 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) {
41832         LDKOpenChannelV2 this_ptr_conv;
41833         this_ptr_conv.inner = untag_ptr(this_ptr);
41834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41836         this_ptr_conv.is_owned = false;
41837         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
41838         return ret_conv;
41839 }
41840
41841 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) {
41842         LDKOpenChannelV2 this_ptr_conv;
41843         this_ptr_conv.inner = untag_ptr(this_ptr);
41844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41846         this_ptr_conv.is_owned = false;
41847         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
41848 }
41849
41850 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
41851         LDKOpenChannelV2 this_ptr_conv;
41852         this_ptr_conv.inner = untag_ptr(this_ptr);
41853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41855         this_ptr_conv.is_owned = false;
41856         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
41857         return ret_conv;
41858 }
41859
41860 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
41861         LDKOpenChannelV2 this_ptr_conv;
41862         this_ptr_conv.inner = untag_ptr(this_ptr);
41863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41865         this_ptr_conv.is_owned = false;
41866         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
41867 }
41868
41869 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
41870         LDKOpenChannelV2 this_ptr_conv;
41871         this_ptr_conv.inner = untag_ptr(this_ptr);
41872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41874         this_ptr_conv.is_owned = false;
41875         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
41876         return ret_conv;
41877 }
41878
41879 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
41880         LDKOpenChannelV2 this_ptr_conv;
41881         this_ptr_conv.inner = untag_ptr(this_ptr);
41882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41884         this_ptr_conv.is_owned = false;
41885         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
41886 }
41887
41888 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) {
41889         LDKOpenChannelV2 this_ptr_conv;
41890         this_ptr_conv.inner = untag_ptr(this_ptr);
41891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41893         this_ptr_conv.is_owned = false;
41894         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41895         return ret_conv;
41896 }
41897
41898 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) {
41899         LDKOpenChannelV2 this_ptr_conv;
41900         this_ptr_conv.inner = untag_ptr(this_ptr);
41901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41903         this_ptr_conv.is_owned = false;
41904         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41905 }
41906
41907 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
41908         LDKOpenChannelV2 this_ptr_conv;
41909         this_ptr_conv.inner = untag_ptr(this_ptr);
41910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41912         this_ptr_conv.is_owned = false;
41913         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
41914         return ret_conv;
41915 }
41916
41917 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41918         LDKOpenChannelV2 this_ptr_conv;
41919         this_ptr_conv.inner = untag_ptr(this_ptr);
41920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41922         this_ptr_conv.is_owned = false;
41923         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
41924 }
41925
41926 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
41927         LDKOpenChannelV2 this_ptr_conv;
41928         this_ptr_conv.inner = untag_ptr(this_ptr);
41929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41931         this_ptr_conv.is_owned = false;
41932         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
41933         return ret_conv;
41934 }
41935
41936 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
41937         LDKOpenChannelV2 this_ptr_conv;
41938         this_ptr_conv.inner = untag_ptr(this_ptr);
41939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41941         this_ptr_conv.is_owned = false;
41942         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
41943 }
41944
41945 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
41946         LDKOpenChannelV2 this_ptr_conv;
41947         this_ptr_conv.inner = untag_ptr(this_ptr);
41948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41950         this_ptr_conv.is_owned = false;
41951         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
41952         return ret_conv;
41953 }
41954
41955 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
41956         LDKOpenChannelV2 this_ptr_conv;
41957         this_ptr_conv.inner = untag_ptr(this_ptr);
41958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41960         this_ptr_conv.is_owned = false;
41961         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
41962 }
41963
41964 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
41965         LDKOpenChannelV2 this_ptr_conv;
41966         this_ptr_conv.inner = untag_ptr(this_ptr);
41967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41969         this_ptr_conv.is_owned = false;
41970         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
41971         return ret_conv;
41972 }
41973
41974 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
41975         LDKOpenChannelV2 this_ptr_conv;
41976         this_ptr_conv.inner = untag_ptr(this_ptr);
41977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41979         this_ptr_conv.is_owned = false;
41980         OpenChannelV2_set_locktime(&this_ptr_conv, val);
41981 }
41982
41983 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
41984         LDKOpenChannelV2 this_ptr_conv;
41985         this_ptr_conv.inner = untag_ptr(this_ptr);
41986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41988         this_ptr_conv.is_owned = false;
41989         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41990         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
41991         return ret_arr;
41992 }
41993
41994 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
41995         LDKOpenChannelV2 this_ptr_conv;
41996         this_ptr_conv.inner = untag_ptr(this_ptr);
41997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41999         this_ptr_conv.is_owned = false;
42000         LDKPublicKey val_ref;
42001         CHECK(val->arr_len == 33);
42002         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42003         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42004 }
42005
42006 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
42007         LDKOpenChannelV2 this_ptr_conv;
42008         this_ptr_conv.inner = untag_ptr(this_ptr);
42009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42011         this_ptr_conv.is_owned = false;
42012         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42013         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42014         return ret_arr;
42015 }
42016
42017 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
42018         LDKOpenChannelV2 this_ptr_conv;
42019         this_ptr_conv.inner = untag_ptr(this_ptr);
42020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42022         this_ptr_conv.is_owned = false;
42023         LDKPublicKey val_ref;
42024         CHECK(val->arr_len == 33);
42025         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42026         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
42027 }
42028
42029 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
42030         LDKOpenChannelV2 this_ptr_conv;
42031         this_ptr_conv.inner = untag_ptr(this_ptr);
42032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42034         this_ptr_conv.is_owned = false;
42035         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42036         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42037         return ret_arr;
42038 }
42039
42040 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
42041         LDKOpenChannelV2 this_ptr_conv;
42042         this_ptr_conv.inner = untag_ptr(this_ptr);
42043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42045         this_ptr_conv.is_owned = false;
42046         LDKPublicKey val_ref;
42047         CHECK(val->arr_len == 33);
42048         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42049         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
42050 }
42051
42052 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
42053         LDKOpenChannelV2 this_ptr_conv;
42054         this_ptr_conv.inner = untag_ptr(this_ptr);
42055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42057         this_ptr_conv.is_owned = false;
42058         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42059         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42060         return ret_arr;
42061 }
42062
42063 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
42064         LDKOpenChannelV2 this_ptr_conv;
42065         this_ptr_conv.inner = untag_ptr(this_ptr);
42066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42068         this_ptr_conv.is_owned = false;
42069         LDKPublicKey val_ref;
42070         CHECK(val->arr_len == 33);
42071         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42072         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42073 }
42074
42075 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
42076         LDKOpenChannelV2 this_ptr_conv;
42077         this_ptr_conv.inner = untag_ptr(this_ptr);
42078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42080         this_ptr_conv.is_owned = false;
42081         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42082         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42083         return ret_arr;
42084 }
42085
42086 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
42087         LDKOpenChannelV2 this_ptr_conv;
42088         this_ptr_conv.inner = untag_ptr(this_ptr);
42089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42091         this_ptr_conv.is_owned = false;
42092         LDKPublicKey val_ref;
42093         CHECK(val->arr_len == 33);
42094         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42095         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
42096 }
42097
42098 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
42099         LDKOpenChannelV2 this_ptr_conv;
42100         this_ptr_conv.inner = untag_ptr(this_ptr);
42101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42103         this_ptr_conv.is_owned = false;
42104         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42105         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42106         return ret_arr;
42107 }
42108
42109 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) {
42110         LDKOpenChannelV2 this_ptr_conv;
42111         this_ptr_conv.inner = untag_ptr(this_ptr);
42112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42114         this_ptr_conv.is_owned = false;
42115         LDKPublicKey val_ref;
42116         CHECK(val->arr_len == 33);
42117         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42118         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42119 }
42120
42121 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
42122         LDKOpenChannelV2 this_ptr_conv;
42123         this_ptr_conv.inner = untag_ptr(this_ptr);
42124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42126         this_ptr_conv.is_owned = false;
42127         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42128         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42129         return ret_arr;
42130 }
42131
42132 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) {
42133         LDKOpenChannelV2 this_ptr_conv;
42134         this_ptr_conv.inner = untag_ptr(this_ptr);
42135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42137         this_ptr_conv.is_owned = false;
42138         LDKPublicKey val_ref;
42139         CHECK(val->arr_len == 33);
42140         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42141         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
42142 }
42143
42144 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
42145         LDKOpenChannelV2 this_ptr_conv;
42146         this_ptr_conv.inner = untag_ptr(this_ptr);
42147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42149         this_ptr_conv.is_owned = false;
42150         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
42151         return ret_conv;
42152 }
42153
42154 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
42155         LDKOpenChannelV2 this_ptr_conv;
42156         this_ptr_conv.inner = untag_ptr(this_ptr);
42157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42159         this_ptr_conv.is_owned = false;
42160         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
42161 }
42162
42163 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
42164         LDKOpenChannelV2 this_ptr_conv;
42165         this_ptr_conv.inner = untag_ptr(this_ptr);
42166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42168         this_ptr_conv.is_owned = false;
42169         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42170         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
42171         uint64_t ret_ref = tag_ptr(ret_copy, true);
42172         return ret_ref;
42173 }
42174
42175 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
42176         LDKOpenChannelV2 this_ptr_conv;
42177         this_ptr_conv.inner = untag_ptr(this_ptr);
42178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42180         this_ptr_conv.is_owned = false;
42181         void* val_ptr = untag_ptr(val);
42182         CHECK_ACCESS(val_ptr);
42183         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42184         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42185         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42186 }
42187
42188 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
42189         LDKOpenChannelV2 this_ptr_conv;
42190         this_ptr_conv.inner = untag_ptr(this_ptr);
42191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42193         this_ptr_conv.is_owned = false;
42194         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
42195         uint64_t ret_ref = 0;
42196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42198         return ret_ref;
42199 }
42200
42201 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
42202         LDKOpenChannelV2 this_ptr_conv;
42203         this_ptr_conv.inner = untag_ptr(this_ptr);
42204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42206         this_ptr_conv.is_owned = false;
42207         LDKChannelTypeFeatures val_conv;
42208         val_conv.inner = untag_ptr(val);
42209         val_conv.is_owned = ptr_is_owned(val);
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42211         val_conv = ChannelTypeFeatures_clone(&val_conv);
42212         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
42213 }
42214
42215 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
42216         LDKOpenChannelV2 this_ptr_conv;
42217         this_ptr_conv.inner = untag_ptr(this_ptr);
42218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42220         this_ptr_conv.is_owned = false;
42221         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
42222         return ret_conv;
42223 }
42224
42225 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
42226         LDKOpenChannelV2 this_ptr_conv;
42227         this_ptr_conv.inner = untag_ptr(this_ptr);
42228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42230         this_ptr_conv.is_owned = false;
42231         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
42232         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
42233 }
42234
42235 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) {
42236         LDKThirtyTwoBytes chain_hash_arg_ref;
42237         CHECK(chain_hash_arg->arr_len == 32);
42238         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42239         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42240         CHECK(temporary_channel_id_arg->arr_len == 32);
42241         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42242         LDKPublicKey funding_pubkey_arg_ref;
42243         CHECK(funding_pubkey_arg->arr_len == 33);
42244         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42245         LDKPublicKey revocation_basepoint_arg_ref;
42246         CHECK(revocation_basepoint_arg->arr_len == 33);
42247         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42248         LDKPublicKey payment_basepoint_arg_ref;
42249         CHECK(payment_basepoint_arg->arr_len == 33);
42250         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
42251         LDKPublicKey delayed_payment_basepoint_arg_ref;
42252         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42253         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42254         LDKPublicKey htlc_basepoint_arg_ref;
42255         CHECK(htlc_basepoint_arg->arr_len == 33);
42256         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42257         LDKPublicKey first_per_commitment_point_arg_ref;
42258         CHECK(first_per_commitment_point_arg->arr_len == 33);
42259         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42260         LDKPublicKey second_per_commitment_point_arg_ref;
42261         CHECK(second_per_commitment_point_arg->arr_len == 33);
42262         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
42263         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42264         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42265         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42266         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42267         LDKChannelTypeFeatures channel_type_arg_conv;
42268         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42269         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42270         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42271         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42272         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
42273         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);
42274         uint64_t ret_ref = 0;
42275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42277         return ret_ref;
42278 }
42279
42280 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
42281         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
42282         uint64_t ret_ref = 0;
42283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42285         return ret_ref;
42286 }
42287 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
42288         LDKOpenChannelV2 arg_conv;
42289         arg_conv.inner = untag_ptr(arg);
42290         arg_conv.is_owned = ptr_is_owned(arg);
42291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42292         arg_conv.is_owned = false;
42293         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
42294         return ret_conv;
42295 }
42296
42297 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
42298         LDKOpenChannelV2 orig_conv;
42299         orig_conv.inner = untag_ptr(orig);
42300         orig_conv.is_owned = ptr_is_owned(orig);
42301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42302         orig_conv.is_owned = false;
42303         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
42304         uint64_t ret_ref = 0;
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42307         return ret_ref;
42308 }
42309
42310 int64_t  __attribute__((export_name("TS_OpenChannelV2_hash"))) TS_OpenChannelV2_hash(uint64_t o) {
42311         LDKOpenChannelV2 o_conv;
42312         o_conv.inner = untag_ptr(o);
42313         o_conv.is_owned = ptr_is_owned(o);
42314         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42315         o_conv.is_owned = false;
42316         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
42317         return ret_conv;
42318 }
42319
42320 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
42321         LDKOpenChannelV2 a_conv;
42322         a_conv.inner = untag_ptr(a);
42323         a_conv.is_owned = ptr_is_owned(a);
42324         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42325         a_conv.is_owned = false;
42326         LDKOpenChannelV2 b_conv;
42327         b_conv.inner = untag_ptr(b);
42328         b_conv.is_owned = ptr_is_owned(b);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42330         b_conv.is_owned = false;
42331         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
42332         return ret_conv;
42333 }
42334
42335 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
42336         LDKAcceptChannel this_obj_conv;
42337         this_obj_conv.inner = untag_ptr(this_obj);
42338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42340         AcceptChannel_free(this_obj_conv);
42341 }
42342
42343 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
42344         LDKAcceptChannel this_ptr_conv;
42345         this_ptr_conv.inner = untag_ptr(this_ptr);
42346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42348         this_ptr_conv.is_owned = false;
42349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42350         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
42351         return ret_arr;
42352 }
42353
42354 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
42355         LDKAcceptChannel this_ptr_conv;
42356         this_ptr_conv.inner = untag_ptr(this_ptr);
42357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359         this_ptr_conv.is_owned = false;
42360         LDKThirtyTwoBytes val_ref;
42361         CHECK(val->arr_len == 32);
42362         memcpy(val_ref.data, val->elems, 32); FREE(val);
42363         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42364 }
42365
42366 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
42367         LDKAcceptChannel this_ptr_conv;
42368         this_ptr_conv.inner = untag_ptr(this_ptr);
42369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42371         this_ptr_conv.is_owned = false;
42372         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
42373         return ret_conv;
42374 }
42375
42376 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
42377         LDKAcceptChannel this_ptr_conv;
42378         this_ptr_conv.inner = untag_ptr(this_ptr);
42379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42381         this_ptr_conv.is_owned = false;
42382         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42383 }
42384
42385 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) {
42386         LDKAcceptChannel this_ptr_conv;
42387         this_ptr_conv.inner = untag_ptr(this_ptr);
42388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42390         this_ptr_conv.is_owned = false;
42391         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42392         return ret_conv;
42393 }
42394
42395 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) {
42396         LDKAcceptChannel this_ptr_conv;
42397         this_ptr_conv.inner = untag_ptr(this_ptr);
42398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42400         this_ptr_conv.is_owned = false;
42401         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42402 }
42403
42404 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
42405         LDKAcceptChannel this_ptr_conv;
42406         this_ptr_conv.inner = untag_ptr(this_ptr);
42407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42409         this_ptr_conv.is_owned = false;
42410         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
42411         return ret_conv;
42412 }
42413
42414 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
42415         LDKAcceptChannel this_ptr_conv;
42416         this_ptr_conv.inner = untag_ptr(this_ptr);
42417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42419         this_ptr_conv.is_owned = false;
42420         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
42421 }
42422
42423 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
42424         LDKAcceptChannel this_ptr_conv;
42425         this_ptr_conv.inner = untag_ptr(this_ptr);
42426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42428         this_ptr_conv.is_owned = false;
42429         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
42430         return ret_conv;
42431 }
42432
42433 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
42434         LDKAcceptChannel this_ptr_conv;
42435         this_ptr_conv.inner = untag_ptr(this_ptr);
42436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42438         this_ptr_conv.is_owned = false;
42439         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
42440 }
42441
42442 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
42443         LDKAcceptChannel this_ptr_conv;
42444         this_ptr_conv.inner = untag_ptr(this_ptr);
42445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42447         this_ptr_conv.is_owned = false;
42448         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
42449         return ret_conv;
42450 }
42451
42452 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
42453         LDKAcceptChannel this_ptr_conv;
42454         this_ptr_conv.inner = untag_ptr(this_ptr);
42455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42457         this_ptr_conv.is_owned = false;
42458         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
42459 }
42460
42461 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
42462         LDKAcceptChannel this_ptr_conv;
42463         this_ptr_conv.inner = untag_ptr(this_ptr);
42464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42466         this_ptr_conv.is_owned = false;
42467         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
42468         return ret_conv;
42469 }
42470
42471 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
42472         LDKAcceptChannel this_ptr_conv;
42473         this_ptr_conv.inner = untag_ptr(this_ptr);
42474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42476         this_ptr_conv.is_owned = false;
42477         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
42478 }
42479
42480 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
42481         LDKAcceptChannel this_ptr_conv;
42482         this_ptr_conv.inner = untag_ptr(this_ptr);
42483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42485         this_ptr_conv.is_owned = false;
42486         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
42487         return ret_conv;
42488 }
42489
42490 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
42491         LDKAcceptChannel this_ptr_conv;
42492         this_ptr_conv.inner = untag_ptr(this_ptr);
42493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42495         this_ptr_conv.is_owned = false;
42496         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
42497 }
42498
42499 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
42500         LDKAcceptChannel this_ptr_conv;
42501         this_ptr_conv.inner = untag_ptr(this_ptr);
42502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42504         this_ptr_conv.is_owned = false;
42505         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42506         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42507         return ret_arr;
42508 }
42509
42510 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
42511         LDKAcceptChannel this_ptr_conv;
42512         this_ptr_conv.inner = untag_ptr(this_ptr);
42513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42515         this_ptr_conv.is_owned = false;
42516         LDKPublicKey val_ref;
42517         CHECK(val->arr_len == 33);
42518         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42519         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
42520 }
42521
42522 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
42523         LDKAcceptChannel this_ptr_conv;
42524         this_ptr_conv.inner = untag_ptr(this_ptr);
42525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42527         this_ptr_conv.is_owned = false;
42528         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42529         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42530         return ret_arr;
42531 }
42532
42533 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
42534         LDKAcceptChannel this_ptr_conv;
42535         this_ptr_conv.inner = untag_ptr(this_ptr);
42536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42538         this_ptr_conv.is_owned = false;
42539         LDKPublicKey val_ref;
42540         CHECK(val->arr_len == 33);
42541         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42542         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
42543 }
42544
42545 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
42546         LDKAcceptChannel this_ptr_conv;
42547         this_ptr_conv.inner = untag_ptr(this_ptr);
42548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42550         this_ptr_conv.is_owned = false;
42551         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42552         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
42553         return ret_arr;
42554 }
42555
42556 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
42557         LDKAcceptChannel this_ptr_conv;
42558         this_ptr_conv.inner = untag_ptr(this_ptr);
42559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42561         this_ptr_conv.is_owned = false;
42562         LDKPublicKey val_ref;
42563         CHECK(val->arr_len == 33);
42564         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42565         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
42566 }
42567
42568 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
42569         LDKAcceptChannel this_ptr_conv;
42570         this_ptr_conv.inner = untag_ptr(this_ptr);
42571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42573         this_ptr_conv.is_owned = false;
42574         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42575         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42576         return ret_arr;
42577 }
42578
42579 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
42580         LDKAcceptChannel this_ptr_conv;
42581         this_ptr_conv.inner = untag_ptr(this_ptr);
42582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42584         this_ptr_conv.is_owned = false;
42585         LDKPublicKey val_ref;
42586         CHECK(val->arr_len == 33);
42587         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42588         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42589 }
42590
42591 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
42592         LDKAcceptChannel this_ptr_conv;
42593         this_ptr_conv.inner = untag_ptr(this_ptr);
42594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42596         this_ptr_conv.is_owned = false;
42597         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42598         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42599         return ret_arr;
42600 }
42601
42602 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
42603         LDKAcceptChannel this_ptr_conv;
42604         this_ptr_conv.inner = untag_ptr(this_ptr);
42605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42607         this_ptr_conv.is_owned = false;
42608         LDKPublicKey val_ref;
42609         CHECK(val->arr_len == 33);
42610         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42611         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
42612 }
42613
42614 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
42615         LDKAcceptChannel this_ptr_conv;
42616         this_ptr_conv.inner = untag_ptr(this_ptr);
42617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42619         this_ptr_conv.is_owned = false;
42620         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42621         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42622         return ret_arr;
42623 }
42624
42625 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) {
42626         LDKAcceptChannel this_ptr_conv;
42627         this_ptr_conv.inner = untag_ptr(this_ptr);
42628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42630         this_ptr_conv.is_owned = false;
42631         LDKPublicKey val_ref;
42632         CHECK(val->arr_len == 33);
42633         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42634         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42635 }
42636
42637 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
42638         LDKAcceptChannel this_ptr_conv;
42639         this_ptr_conv.inner = untag_ptr(this_ptr);
42640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42642         this_ptr_conv.is_owned = false;
42643         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42644         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
42645         uint64_t ret_ref = tag_ptr(ret_copy, true);
42646         return ret_ref;
42647 }
42648
42649 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
42650         LDKAcceptChannel this_ptr_conv;
42651         this_ptr_conv.inner = untag_ptr(this_ptr);
42652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42654         this_ptr_conv.is_owned = false;
42655         void* val_ptr = untag_ptr(val);
42656         CHECK_ACCESS(val_ptr);
42657         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42658         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42659         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42660 }
42661
42662 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
42663         LDKAcceptChannel this_ptr_conv;
42664         this_ptr_conv.inner = untag_ptr(this_ptr);
42665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42667         this_ptr_conv.is_owned = false;
42668         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
42669         uint64_t ret_ref = 0;
42670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42672         return ret_ref;
42673 }
42674
42675 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
42676         LDKAcceptChannel this_ptr_conv;
42677         this_ptr_conv.inner = untag_ptr(this_ptr);
42678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42680         this_ptr_conv.is_owned = false;
42681         LDKChannelTypeFeatures val_conv;
42682         val_conv.inner = untag_ptr(val);
42683         val_conv.is_owned = ptr_is_owned(val);
42684         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42685         val_conv = ChannelTypeFeatures_clone(&val_conv);
42686         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
42687 }
42688
42689 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) {
42690         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42691         CHECK(temporary_channel_id_arg->arr_len == 32);
42692         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42693         LDKPublicKey funding_pubkey_arg_ref;
42694         CHECK(funding_pubkey_arg->arr_len == 33);
42695         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42696         LDKPublicKey revocation_basepoint_arg_ref;
42697         CHECK(revocation_basepoint_arg->arr_len == 33);
42698         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42699         LDKPublicKey payment_point_arg_ref;
42700         CHECK(payment_point_arg->arr_len == 33);
42701         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
42702         LDKPublicKey delayed_payment_basepoint_arg_ref;
42703         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42704         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42705         LDKPublicKey htlc_basepoint_arg_ref;
42706         CHECK(htlc_basepoint_arg->arr_len == 33);
42707         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42708         LDKPublicKey first_per_commitment_point_arg_ref;
42709         CHECK(first_per_commitment_point_arg->arr_len == 33);
42710         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42711         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42712         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42713         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42714         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42715         LDKChannelTypeFeatures channel_type_arg_conv;
42716         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42717         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42718         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42719         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42720         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);
42721         uint64_t ret_ref = 0;
42722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42724         return ret_ref;
42725 }
42726
42727 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
42728         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
42729         uint64_t ret_ref = 0;
42730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42732         return ret_ref;
42733 }
42734 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
42735         LDKAcceptChannel arg_conv;
42736         arg_conv.inner = untag_ptr(arg);
42737         arg_conv.is_owned = ptr_is_owned(arg);
42738         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42739         arg_conv.is_owned = false;
42740         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
42741         return ret_conv;
42742 }
42743
42744 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
42745         LDKAcceptChannel orig_conv;
42746         orig_conv.inner = untag_ptr(orig);
42747         orig_conv.is_owned = ptr_is_owned(orig);
42748         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42749         orig_conv.is_owned = false;
42750         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
42751         uint64_t ret_ref = 0;
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42754         return ret_ref;
42755 }
42756
42757 int64_t  __attribute__((export_name("TS_AcceptChannel_hash"))) TS_AcceptChannel_hash(uint64_t o) {
42758         LDKAcceptChannel o_conv;
42759         o_conv.inner = untag_ptr(o);
42760         o_conv.is_owned = ptr_is_owned(o);
42761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42762         o_conv.is_owned = false;
42763         int64_t ret_conv = AcceptChannel_hash(&o_conv);
42764         return ret_conv;
42765 }
42766
42767 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
42768         LDKAcceptChannel a_conv;
42769         a_conv.inner = untag_ptr(a);
42770         a_conv.is_owned = ptr_is_owned(a);
42771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42772         a_conv.is_owned = false;
42773         LDKAcceptChannel b_conv;
42774         b_conv.inner = untag_ptr(b);
42775         b_conv.is_owned = ptr_is_owned(b);
42776         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42777         b_conv.is_owned = false;
42778         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
42779         return ret_conv;
42780 }
42781
42782 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
42783         LDKAcceptChannelV2 this_obj_conv;
42784         this_obj_conv.inner = untag_ptr(this_obj);
42785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42787         AcceptChannelV2_free(this_obj_conv);
42788 }
42789
42790 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
42791         LDKAcceptChannelV2 this_ptr_conv;
42792         this_ptr_conv.inner = untag_ptr(this_ptr);
42793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42795         this_ptr_conv.is_owned = false;
42796         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42797         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
42798         return ret_arr;
42799 }
42800
42801 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
42802         LDKAcceptChannelV2 this_ptr_conv;
42803         this_ptr_conv.inner = untag_ptr(this_ptr);
42804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42806         this_ptr_conv.is_owned = false;
42807         LDKThirtyTwoBytes val_ref;
42808         CHECK(val->arr_len == 32);
42809         memcpy(val_ref.data, val->elems, 32); FREE(val);
42810         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
42811 }
42812
42813 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
42814         LDKAcceptChannelV2 this_ptr_conv;
42815         this_ptr_conv.inner = untag_ptr(this_ptr);
42816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42818         this_ptr_conv.is_owned = false;
42819         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
42820         return ret_conv;
42821 }
42822
42823 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
42824         LDKAcceptChannelV2 this_ptr_conv;
42825         this_ptr_conv.inner = untag_ptr(this_ptr);
42826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42828         this_ptr_conv.is_owned = false;
42829         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
42830 }
42831
42832 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
42833         LDKAcceptChannelV2 this_ptr_conv;
42834         this_ptr_conv.inner = untag_ptr(this_ptr);
42835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42837         this_ptr_conv.is_owned = false;
42838         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
42839         return ret_conv;
42840 }
42841
42842 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
42843         LDKAcceptChannelV2 this_ptr_conv;
42844         this_ptr_conv.inner = untag_ptr(this_ptr);
42845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42847         this_ptr_conv.is_owned = false;
42848         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
42849 }
42850
42851 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) {
42852         LDKAcceptChannelV2 this_ptr_conv;
42853         this_ptr_conv.inner = untag_ptr(this_ptr);
42854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42856         this_ptr_conv.is_owned = false;
42857         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42858         return ret_conv;
42859 }
42860
42861 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) {
42862         LDKAcceptChannelV2 this_ptr_conv;
42863         this_ptr_conv.inner = untag_ptr(this_ptr);
42864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42866         this_ptr_conv.is_owned = false;
42867         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42868 }
42869
42870 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
42871         LDKAcceptChannelV2 this_ptr_conv;
42872         this_ptr_conv.inner = untag_ptr(this_ptr);
42873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42875         this_ptr_conv.is_owned = false;
42876         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
42877         return ret_conv;
42878 }
42879
42880 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
42881         LDKAcceptChannelV2 this_ptr_conv;
42882         this_ptr_conv.inner = untag_ptr(this_ptr);
42883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42885         this_ptr_conv.is_owned = false;
42886         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
42887 }
42888
42889 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
42890         LDKAcceptChannelV2 this_ptr_conv;
42891         this_ptr_conv.inner = untag_ptr(this_ptr);
42892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42894         this_ptr_conv.is_owned = false;
42895         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
42896         return ret_conv;
42897 }
42898
42899 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
42900         LDKAcceptChannelV2 this_ptr_conv;
42901         this_ptr_conv.inner = untag_ptr(this_ptr);
42902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42904         this_ptr_conv.is_owned = false;
42905         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
42906 }
42907
42908 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
42909         LDKAcceptChannelV2 this_ptr_conv;
42910         this_ptr_conv.inner = untag_ptr(this_ptr);
42911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42913         this_ptr_conv.is_owned = false;
42914         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
42915         return ret_conv;
42916 }
42917
42918 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
42919         LDKAcceptChannelV2 this_ptr_conv;
42920         this_ptr_conv.inner = untag_ptr(this_ptr);
42921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42923         this_ptr_conv.is_owned = false;
42924         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
42925 }
42926
42927 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
42928         LDKAcceptChannelV2 this_ptr_conv;
42929         this_ptr_conv.inner = untag_ptr(this_ptr);
42930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42932         this_ptr_conv.is_owned = false;
42933         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
42934         return ret_conv;
42935 }
42936
42937 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
42938         LDKAcceptChannelV2 this_ptr_conv;
42939         this_ptr_conv.inner = untag_ptr(this_ptr);
42940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42942         this_ptr_conv.is_owned = false;
42943         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
42944 }
42945
42946 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
42947         LDKAcceptChannelV2 this_ptr_conv;
42948         this_ptr_conv.inner = untag_ptr(this_ptr);
42949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42951         this_ptr_conv.is_owned = false;
42952         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42953         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42954         return ret_arr;
42955 }
42956
42957 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
42958         LDKAcceptChannelV2 this_ptr_conv;
42959         this_ptr_conv.inner = untag_ptr(this_ptr);
42960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42962         this_ptr_conv.is_owned = false;
42963         LDKPublicKey val_ref;
42964         CHECK(val->arr_len == 33);
42965         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42966         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42967 }
42968
42969 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
42970         LDKAcceptChannelV2 this_ptr_conv;
42971         this_ptr_conv.inner = untag_ptr(this_ptr);
42972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42974         this_ptr_conv.is_owned = false;
42975         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42976         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42977         return ret_arr;
42978 }
42979
42980 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
42981         LDKAcceptChannelV2 this_ptr_conv;
42982         this_ptr_conv.inner = untag_ptr(this_ptr);
42983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42985         this_ptr_conv.is_owned = false;
42986         LDKPublicKey val_ref;
42987         CHECK(val->arr_len == 33);
42988         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42989         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
42990 }
42991
42992 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
42993         LDKAcceptChannelV2 this_ptr_conv;
42994         this_ptr_conv.inner = untag_ptr(this_ptr);
42995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42997         this_ptr_conv.is_owned = false;
42998         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42999         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43000         return ret_arr;
43001 }
43002
43003 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
43004         LDKAcceptChannelV2 this_ptr_conv;
43005         this_ptr_conv.inner = untag_ptr(this_ptr);
43006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43008         this_ptr_conv.is_owned = false;
43009         LDKPublicKey val_ref;
43010         CHECK(val->arr_len == 33);
43011         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43012         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43013 }
43014
43015 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
43016         LDKAcceptChannelV2 this_ptr_conv;
43017         this_ptr_conv.inner = untag_ptr(this_ptr);
43018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43020         this_ptr_conv.is_owned = false;
43021         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43022         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43023         return ret_arr;
43024 }
43025
43026 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
43027         LDKAcceptChannelV2 this_ptr_conv;
43028         this_ptr_conv.inner = untag_ptr(this_ptr);
43029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43031         this_ptr_conv.is_owned = false;
43032         LDKPublicKey val_ref;
43033         CHECK(val->arr_len == 33);
43034         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43035         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43036 }
43037
43038 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
43039         LDKAcceptChannelV2 this_ptr_conv;
43040         this_ptr_conv.inner = untag_ptr(this_ptr);
43041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43043         this_ptr_conv.is_owned = false;
43044         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43045         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
43046         return ret_arr;
43047 }
43048
43049 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
43050         LDKAcceptChannelV2 this_ptr_conv;
43051         this_ptr_conv.inner = untag_ptr(this_ptr);
43052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43054         this_ptr_conv.is_owned = false;
43055         LDKPublicKey val_ref;
43056         CHECK(val->arr_len == 33);
43057         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43058         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43059 }
43060
43061 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
43062         LDKAcceptChannelV2 this_ptr_conv;
43063         this_ptr_conv.inner = untag_ptr(this_ptr);
43064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43066         this_ptr_conv.is_owned = false;
43067         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43068         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43069         return ret_arr;
43070 }
43071
43072 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) {
43073         LDKAcceptChannelV2 this_ptr_conv;
43074         this_ptr_conv.inner = untag_ptr(this_ptr);
43075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43077         this_ptr_conv.is_owned = false;
43078         LDKPublicKey val_ref;
43079         CHECK(val->arr_len == 33);
43080         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43081         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43082 }
43083
43084 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
43085         LDKAcceptChannelV2 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43091         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43092         return ret_arr;
43093 }
43094
43095 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) {
43096         LDKAcceptChannelV2 this_ptr_conv;
43097         this_ptr_conv.inner = untag_ptr(this_ptr);
43098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43100         this_ptr_conv.is_owned = false;
43101         LDKPublicKey val_ref;
43102         CHECK(val->arr_len == 33);
43103         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43104         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43105 }
43106
43107 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
43108         LDKAcceptChannelV2 this_ptr_conv;
43109         this_ptr_conv.inner = untag_ptr(this_ptr);
43110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43112         this_ptr_conv.is_owned = false;
43113         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43114         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43115         uint64_t ret_ref = tag_ptr(ret_copy, true);
43116         return ret_ref;
43117 }
43118
43119 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
43120         LDKAcceptChannelV2 this_ptr_conv;
43121         this_ptr_conv.inner = untag_ptr(this_ptr);
43122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43124         this_ptr_conv.is_owned = false;
43125         void* val_ptr = untag_ptr(val);
43126         CHECK_ACCESS(val_ptr);
43127         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43128         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43129         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43130 }
43131
43132 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
43133         LDKAcceptChannelV2 this_ptr_conv;
43134         this_ptr_conv.inner = untag_ptr(this_ptr);
43135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43137         this_ptr_conv.is_owned = false;
43138         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
43139         uint64_t ret_ref = 0;
43140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43142         return ret_ref;
43143 }
43144
43145 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
43146         LDKAcceptChannelV2 this_ptr_conv;
43147         this_ptr_conv.inner = untag_ptr(this_ptr);
43148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43150         this_ptr_conv.is_owned = false;
43151         LDKChannelTypeFeatures val_conv;
43152         val_conv.inner = untag_ptr(val);
43153         val_conv.is_owned = ptr_is_owned(val);
43154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43155         val_conv = ChannelTypeFeatures_clone(&val_conv);
43156         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43157 }
43158
43159 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
43160         LDKAcceptChannelV2 this_ptr_conv;
43161         this_ptr_conv.inner = untag_ptr(this_ptr);
43162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43164         this_ptr_conv.is_owned = false;
43165         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43166         return ret_conv;
43167 }
43168
43169 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
43170         LDKAcceptChannelV2 this_ptr_conv;
43171         this_ptr_conv.inner = untag_ptr(this_ptr);
43172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43174         this_ptr_conv.is_owned = false;
43175         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
43176         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43177 }
43178
43179 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) {
43180         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43181         CHECK(temporary_channel_id_arg->arr_len == 32);
43182         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43183         LDKPublicKey funding_pubkey_arg_ref;
43184         CHECK(funding_pubkey_arg->arr_len == 33);
43185         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43186         LDKPublicKey revocation_basepoint_arg_ref;
43187         CHECK(revocation_basepoint_arg->arr_len == 33);
43188         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
43189         LDKPublicKey payment_basepoint_arg_ref;
43190         CHECK(payment_basepoint_arg->arr_len == 33);
43191         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
43192         LDKPublicKey delayed_payment_basepoint_arg_ref;
43193         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
43194         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
43195         LDKPublicKey htlc_basepoint_arg_ref;
43196         CHECK(htlc_basepoint_arg->arr_len == 33);
43197         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
43198         LDKPublicKey first_per_commitment_point_arg_ref;
43199         CHECK(first_per_commitment_point_arg->arr_len == 33);
43200         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
43201         LDKPublicKey second_per_commitment_point_arg_ref;
43202         CHECK(second_per_commitment_point_arg->arr_len == 33);
43203         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
43204         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43205         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43206         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43207         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43208         LDKChannelTypeFeatures channel_type_arg_conv;
43209         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43210         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43212         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43213         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
43214         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);
43215         uint64_t ret_ref = 0;
43216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43218         return ret_ref;
43219 }
43220
43221 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
43222         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
43223         uint64_t ret_ref = 0;
43224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43226         return ret_ref;
43227 }
43228 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
43229         LDKAcceptChannelV2 arg_conv;
43230         arg_conv.inner = untag_ptr(arg);
43231         arg_conv.is_owned = ptr_is_owned(arg);
43232         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43233         arg_conv.is_owned = false;
43234         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
43235         return ret_conv;
43236 }
43237
43238 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
43239         LDKAcceptChannelV2 orig_conv;
43240         orig_conv.inner = untag_ptr(orig);
43241         orig_conv.is_owned = ptr_is_owned(orig);
43242         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43243         orig_conv.is_owned = false;
43244         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
43245         uint64_t ret_ref = 0;
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43248         return ret_ref;
43249 }
43250
43251 int64_t  __attribute__((export_name("TS_AcceptChannelV2_hash"))) TS_AcceptChannelV2_hash(uint64_t o) {
43252         LDKAcceptChannelV2 o_conv;
43253         o_conv.inner = untag_ptr(o);
43254         o_conv.is_owned = ptr_is_owned(o);
43255         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43256         o_conv.is_owned = false;
43257         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
43258         return ret_conv;
43259 }
43260
43261 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
43262         LDKAcceptChannelV2 a_conv;
43263         a_conv.inner = untag_ptr(a);
43264         a_conv.is_owned = ptr_is_owned(a);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43266         a_conv.is_owned = false;
43267         LDKAcceptChannelV2 b_conv;
43268         b_conv.inner = untag_ptr(b);
43269         b_conv.is_owned = ptr_is_owned(b);
43270         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43271         b_conv.is_owned = false;
43272         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
43273         return ret_conv;
43274 }
43275
43276 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
43277         LDKFundingCreated this_obj_conv;
43278         this_obj_conv.inner = untag_ptr(this_obj);
43279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43281         FundingCreated_free(this_obj_conv);
43282 }
43283
43284 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
43285         LDKFundingCreated this_ptr_conv;
43286         this_ptr_conv.inner = untag_ptr(this_ptr);
43287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43289         this_ptr_conv.is_owned = false;
43290         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43291         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
43292         return ret_arr;
43293 }
43294
43295 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
43296         LDKFundingCreated this_ptr_conv;
43297         this_ptr_conv.inner = untag_ptr(this_ptr);
43298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43300         this_ptr_conv.is_owned = false;
43301         LDKThirtyTwoBytes val_ref;
43302         CHECK(val->arr_len == 32);
43303         memcpy(val_ref.data, val->elems, 32); FREE(val);
43304         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
43305 }
43306
43307 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
43308         LDKFundingCreated this_ptr_conv;
43309         this_ptr_conv.inner = untag_ptr(this_ptr);
43310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43312         this_ptr_conv.is_owned = false;
43313         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43314         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
43315         return ret_arr;
43316 }
43317
43318 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
43319         LDKFundingCreated this_ptr_conv;
43320         this_ptr_conv.inner = untag_ptr(this_ptr);
43321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43323         this_ptr_conv.is_owned = false;
43324         LDKThirtyTwoBytes val_ref;
43325         CHECK(val->arr_len == 32);
43326         memcpy(val_ref.data, val->elems, 32); FREE(val);
43327         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
43328 }
43329
43330 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
43331         LDKFundingCreated this_ptr_conv;
43332         this_ptr_conv.inner = untag_ptr(this_ptr);
43333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43335         this_ptr_conv.is_owned = false;
43336         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
43337         return ret_conv;
43338 }
43339
43340 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
43341         LDKFundingCreated this_ptr_conv;
43342         this_ptr_conv.inner = untag_ptr(this_ptr);
43343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43345         this_ptr_conv.is_owned = false;
43346         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
43347 }
43348
43349 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
43350         LDKFundingCreated this_ptr_conv;
43351         this_ptr_conv.inner = untag_ptr(this_ptr);
43352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43354         this_ptr_conv.is_owned = false;
43355         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43356         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
43357         return ret_arr;
43358 }
43359
43360 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
43361         LDKFundingCreated this_ptr_conv;
43362         this_ptr_conv.inner = untag_ptr(this_ptr);
43363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43365         this_ptr_conv.is_owned = false;
43366         LDKECDSASignature val_ref;
43367         CHECK(val->arr_len == 64);
43368         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43369         FundingCreated_set_signature(&this_ptr_conv, val_ref);
43370 }
43371
43372 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) {
43373         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43374         CHECK(temporary_channel_id_arg->arr_len == 32);
43375         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43376         LDKThirtyTwoBytes funding_txid_arg_ref;
43377         CHECK(funding_txid_arg->arr_len == 32);
43378         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
43379         LDKECDSASignature signature_arg_ref;
43380         CHECK(signature_arg->arr_len == 64);
43381         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43382         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
43383         uint64_t ret_ref = 0;
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43386         return ret_ref;
43387 }
43388
43389 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
43390         LDKFundingCreated ret_var = FundingCreated_clone(arg);
43391         uint64_t ret_ref = 0;
43392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43394         return ret_ref;
43395 }
43396 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
43397         LDKFundingCreated arg_conv;
43398         arg_conv.inner = untag_ptr(arg);
43399         arg_conv.is_owned = ptr_is_owned(arg);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43401         arg_conv.is_owned = false;
43402         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
43403         return ret_conv;
43404 }
43405
43406 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
43407         LDKFundingCreated orig_conv;
43408         orig_conv.inner = untag_ptr(orig);
43409         orig_conv.is_owned = ptr_is_owned(orig);
43410         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43411         orig_conv.is_owned = false;
43412         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
43413         uint64_t ret_ref = 0;
43414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43416         return ret_ref;
43417 }
43418
43419 int64_t  __attribute__((export_name("TS_FundingCreated_hash"))) TS_FundingCreated_hash(uint64_t o) {
43420         LDKFundingCreated o_conv;
43421         o_conv.inner = untag_ptr(o);
43422         o_conv.is_owned = ptr_is_owned(o);
43423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43424         o_conv.is_owned = false;
43425         int64_t ret_conv = FundingCreated_hash(&o_conv);
43426         return ret_conv;
43427 }
43428
43429 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
43430         LDKFundingCreated a_conv;
43431         a_conv.inner = untag_ptr(a);
43432         a_conv.is_owned = ptr_is_owned(a);
43433         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43434         a_conv.is_owned = false;
43435         LDKFundingCreated b_conv;
43436         b_conv.inner = untag_ptr(b);
43437         b_conv.is_owned = ptr_is_owned(b);
43438         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43439         b_conv.is_owned = false;
43440         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
43441         return ret_conv;
43442 }
43443
43444 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
43445         LDKFundingSigned this_obj_conv;
43446         this_obj_conv.inner = untag_ptr(this_obj);
43447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43449         FundingSigned_free(this_obj_conv);
43450 }
43451
43452 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
43453         LDKFundingSigned this_ptr_conv;
43454         this_ptr_conv.inner = untag_ptr(this_ptr);
43455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43457         this_ptr_conv.is_owned = false;
43458         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43459         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
43460         return ret_arr;
43461 }
43462
43463 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43464         LDKFundingSigned this_ptr_conv;
43465         this_ptr_conv.inner = untag_ptr(this_ptr);
43466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43468         this_ptr_conv.is_owned = false;
43469         LDKThirtyTwoBytes val_ref;
43470         CHECK(val->arr_len == 32);
43471         memcpy(val_ref.data, val->elems, 32); FREE(val);
43472         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
43473 }
43474
43475 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
43476         LDKFundingSigned this_ptr_conv;
43477         this_ptr_conv.inner = untag_ptr(this_ptr);
43478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43480         this_ptr_conv.is_owned = false;
43481         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43482         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
43483         return ret_arr;
43484 }
43485
43486 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
43487         LDKFundingSigned this_ptr_conv;
43488         this_ptr_conv.inner = untag_ptr(this_ptr);
43489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43491         this_ptr_conv.is_owned = false;
43492         LDKECDSASignature val_ref;
43493         CHECK(val->arr_len == 64);
43494         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43495         FundingSigned_set_signature(&this_ptr_conv, val_ref);
43496 }
43497
43498 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
43499         LDKThirtyTwoBytes channel_id_arg_ref;
43500         CHECK(channel_id_arg->arr_len == 32);
43501         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43502         LDKECDSASignature signature_arg_ref;
43503         CHECK(signature_arg->arr_len == 64);
43504         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43505         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
43506         uint64_t ret_ref = 0;
43507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43509         return ret_ref;
43510 }
43511
43512 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
43513         LDKFundingSigned ret_var = FundingSigned_clone(arg);
43514         uint64_t ret_ref = 0;
43515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43517         return ret_ref;
43518 }
43519 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
43520         LDKFundingSigned arg_conv;
43521         arg_conv.inner = untag_ptr(arg);
43522         arg_conv.is_owned = ptr_is_owned(arg);
43523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43524         arg_conv.is_owned = false;
43525         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
43526         return ret_conv;
43527 }
43528
43529 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
43530         LDKFundingSigned orig_conv;
43531         orig_conv.inner = untag_ptr(orig);
43532         orig_conv.is_owned = ptr_is_owned(orig);
43533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43534         orig_conv.is_owned = false;
43535         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
43536         uint64_t ret_ref = 0;
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43539         return ret_ref;
43540 }
43541
43542 int64_t  __attribute__((export_name("TS_FundingSigned_hash"))) TS_FundingSigned_hash(uint64_t o) {
43543         LDKFundingSigned o_conv;
43544         o_conv.inner = untag_ptr(o);
43545         o_conv.is_owned = ptr_is_owned(o);
43546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43547         o_conv.is_owned = false;
43548         int64_t ret_conv = FundingSigned_hash(&o_conv);
43549         return ret_conv;
43550 }
43551
43552 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
43553         LDKFundingSigned a_conv;
43554         a_conv.inner = untag_ptr(a);
43555         a_conv.is_owned = ptr_is_owned(a);
43556         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43557         a_conv.is_owned = false;
43558         LDKFundingSigned b_conv;
43559         b_conv.inner = untag_ptr(b);
43560         b_conv.is_owned = ptr_is_owned(b);
43561         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43562         b_conv.is_owned = false;
43563         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
43564         return ret_conv;
43565 }
43566
43567 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
43568         LDKChannelReady this_obj_conv;
43569         this_obj_conv.inner = untag_ptr(this_obj);
43570         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43572         ChannelReady_free(this_obj_conv);
43573 }
43574
43575 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
43576         LDKChannelReady 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43582         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
43583         return ret_arr;
43584 }
43585
43586 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43587         LDKChannelReady this_ptr_conv;
43588         this_ptr_conv.inner = untag_ptr(this_ptr);
43589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43591         this_ptr_conv.is_owned = false;
43592         LDKThirtyTwoBytes val_ref;
43593         CHECK(val->arr_len == 32);
43594         memcpy(val_ref.data, val->elems, 32); FREE(val);
43595         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
43596 }
43597
43598 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
43599         LDKChannelReady this_ptr_conv;
43600         this_ptr_conv.inner = untag_ptr(this_ptr);
43601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43603         this_ptr_conv.is_owned = false;
43604         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43605         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43606         return ret_arr;
43607 }
43608
43609 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) {
43610         LDKChannelReady this_ptr_conv;
43611         this_ptr_conv.inner = untag_ptr(this_ptr);
43612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43614         this_ptr_conv.is_owned = false;
43615         LDKPublicKey val_ref;
43616         CHECK(val->arr_len == 33);
43617         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43618         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
43619 }
43620
43621 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
43622         LDKChannelReady this_ptr_conv;
43623         this_ptr_conv.inner = untag_ptr(this_ptr);
43624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43626         this_ptr_conv.is_owned = false;
43627         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43628         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
43629         uint64_t ret_ref = tag_ptr(ret_copy, true);
43630         return ret_ref;
43631 }
43632
43633 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) {
43634         LDKChannelReady this_ptr_conv;
43635         this_ptr_conv.inner = untag_ptr(this_ptr);
43636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43638         this_ptr_conv.is_owned = false;
43639         void* val_ptr = untag_ptr(val);
43640         CHECK_ACCESS(val_ptr);
43641         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43642         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43643         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
43644 }
43645
43646 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) {
43647         LDKThirtyTwoBytes channel_id_arg_ref;
43648         CHECK(channel_id_arg->arr_len == 32);
43649         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43650         LDKPublicKey next_per_commitment_point_arg_ref;
43651         CHECK(next_per_commitment_point_arg->arr_len == 33);
43652         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
43653         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
43654         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
43655         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
43656         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
43657         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
43658         uint64_t ret_ref = 0;
43659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43661         return ret_ref;
43662 }
43663
43664 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
43665         LDKChannelReady ret_var = ChannelReady_clone(arg);
43666         uint64_t ret_ref = 0;
43667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43669         return ret_ref;
43670 }
43671 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
43672         LDKChannelReady arg_conv;
43673         arg_conv.inner = untag_ptr(arg);
43674         arg_conv.is_owned = ptr_is_owned(arg);
43675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43676         arg_conv.is_owned = false;
43677         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
43678         return ret_conv;
43679 }
43680
43681 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
43682         LDKChannelReady orig_conv;
43683         orig_conv.inner = untag_ptr(orig);
43684         orig_conv.is_owned = ptr_is_owned(orig);
43685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43686         orig_conv.is_owned = false;
43687         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
43688         uint64_t ret_ref = 0;
43689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43691         return ret_ref;
43692 }
43693
43694 int64_t  __attribute__((export_name("TS_ChannelReady_hash"))) TS_ChannelReady_hash(uint64_t o) {
43695         LDKChannelReady o_conv;
43696         o_conv.inner = untag_ptr(o);
43697         o_conv.is_owned = ptr_is_owned(o);
43698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43699         o_conv.is_owned = false;
43700         int64_t ret_conv = ChannelReady_hash(&o_conv);
43701         return ret_conv;
43702 }
43703
43704 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
43705         LDKChannelReady a_conv;
43706         a_conv.inner = untag_ptr(a);
43707         a_conv.is_owned = ptr_is_owned(a);
43708         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43709         a_conv.is_owned = false;
43710         LDKChannelReady b_conv;
43711         b_conv.inner = untag_ptr(b);
43712         b_conv.is_owned = ptr_is_owned(b);
43713         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43714         b_conv.is_owned = false;
43715         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
43716         return ret_conv;
43717 }
43718
43719 void  __attribute__((export_name("TS_Stfu_free"))) TS_Stfu_free(uint64_t this_obj) {
43720         LDKStfu this_obj_conv;
43721         this_obj_conv.inner = untag_ptr(this_obj);
43722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43724         Stfu_free(this_obj_conv);
43725 }
43726
43727 int8_tArray  __attribute__((export_name("TS_Stfu_get_channel_id"))) TS_Stfu_get_channel_id(uint64_t this_ptr) {
43728         LDKStfu this_ptr_conv;
43729         this_ptr_conv.inner = untag_ptr(this_ptr);
43730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43732         this_ptr_conv.is_owned = false;
43733         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43734         memcpy(ret_arr->elems, *Stfu_get_channel_id(&this_ptr_conv), 32);
43735         return ret_arr;
43736 }
43737
43738 void  __attribute__((export_name("TS_Stfu_set_channel_id"))) TS_Stfu_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43739         LDKStfu this_ptr_conv;
43740         this_ptr_conv.inner = untag_ptr(this_ptr);
43741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43743         this_ptr_conv.is_owned = false;
43744         LDKThirtyTwoBytes val_ref;
43745         CHECK(val->arr_len == 32);
43746         memcpy(val_ref.data, val->elems, 32); FREE(val);
43747         Stfu_set_channel_id(&this_ptr_conv, val_ref);
43748 }
43749
43750 int8_t  __attribute__((export_name("TS_Stfu_get_initiator"))) TS_Stfu_get_initiator(uint64_t this_ptr) {
43751         LDKStfu this_ptr_conv;
43752         this_ptr_conv.inner = untag_ptr(this_ptr);
43753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43755         this_ptr_conv.is_owned = false;
43756         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
43757         return ret_conv;
43758 }
43759
43760 void  __attribute__((export_name("TS_Stfu_set_initiator"))) TS_Stfu_set_initiator(uint64_t this_ptr, int8_t val) {
43761         LDKStfu this_ptr_conv;
43762         this_ptr_conv.inner = untag_ptr(this_ptr);
43763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43765         this_ptr_conv.is_owned = false;
43766         Stfu_set_initiator(&this_ptr_conv, val);
43767 }
43768
43769 uint64_t  __attribute__((export_name("TS_Stfu_new"))) TS_Stfu_new(int8_tArray channel_id_arg, int8_t initiator_arg) {
43770         LDKThirtyTwoBytes channel_id_arg_ref;
43771         CHECK(channel_id_arg->arr_len == 32);
43772         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43773         LDKStfu ret_var = Stfu_new(channel_id_arg_ref, initiator_arg);
43774         uint64_t ret_ref = 0;
43775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43777         return ret_ref;
43778 }
43779
43780 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
43781         LDKStfu ret_var = Stfu_clone(arg);
43782         uint64_t ret_ref = 0;
43783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43785         return ret_ref;
43786 }
43787 int64_t  __attribute__((export_name("TS_Stfu_clone_ptr"))) TS_Stfu_clone_ptr(uint64_t arg) {
43788         LDKStfu arg_conv;
43789         arg_conv.inner = untag_ptr(arg);
43790         arg_conv.is_owned = ptr_is_owned(arg);
43791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43792         arg_conv.is_owned = false;
43793         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
43794         return ret_conv;
43795 }
43796
43797 uint64_t  __attribute__((export_name("TS_Stfu_clone"))) TS_Stfu_clone(uint64_t orig) {
43798         LDKStfu orig_conv;
43799         orig_conv.inner = untag_ptr(orig);
43800         orig_conv.is_owned = ptr_is_owned(orig);
43801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43802         orig_conv.is_owned = false;
43803         LDKStfu ret_var = Stfu_clone(&orig_conv);
43804         uint64_t ret_ref = 0;
43805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43807         return ret_ref;
43808 }
43809
43810 jboolean  __attribute__((export_name("TS_Stfu_eq"))) TS_Stfu_eq(uint64_t a, uint64_t b) {
43811         LDKStfu a_conv;
43812         a_conv.inner = untag_ptr(a);
43813         a_conv.is_owned = ptr_is_owned(a);
43814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43815         a_conv.is_owned = false;
43816         LDKStfu b_conv;
43817         b_conv.inner = untag_ptr(b);
43818         b_conv.is_owned = ptr_is_owned(b);
43819         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43820         b_conv.is_owned = false;
43821         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
43822         return ret_conv;
43823 }
43824
43825 void  __attribute__((export_name("TS_Splice_free"))) TS_Splice_free(uint64_t this_obj) {
43826         LDKSplice this_obj_conv;
43827         this_obj_conv.inner = untag_ptr(this_obj);
43828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43830         Splice_free(this_obj_conv);
43831 }
43832
43833 int8_tArray  __attribute__((export_name("TS_Splice_get_channel_id"))) TS_Splice_get_channel_id(uint64_t this_ptr) {
43834         LDKSplice this_ptr_conv;
43835         this_ptr_conv.inner = untag_ptr(this_ptr);
43836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43838         this_ptr_conv.is_owned = false;
43839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43840         memcpy(ret_arr->elems, *Splice_get_channel_id(&this_ptr_conv), 32);
43841         return ret_arr;
43842 }
43843
43844 void  __attribute__((export_name("TS_Splice_set_channel_id"))) TS_Splice_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43845         LDKSplice this_ptr_conv;
43846         this_ptr_conv.inner = untag_ptr(this_ptr);
43847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43849         this_ptr_conv.is_owned = false;
43850         LDKThirtyTwoBytes val_ref;
43851         CHECK(val->arr_len == 32);
43852         memcpy(val_ref.data, val->elems, 32); FREE(val);
43853         Splice_set_channel_id(&this_ptr_conv, val_ref);
43854 }
43855
43856 int8_tArray  __attribute__((export_name("TS_Splice_get_chain_hash"))) TS_Splice_get_chain_hash(uint64_t this_ptr) {
43857         LDKSplice this_ptr_conv;
43858         this_ptr_conv.inner = untag_ptr(this_ptr);
43859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43861         this_ptr_conv.is_owned = false;
43862         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43863         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
43864         return ret_arr;
43865 }
43866
43867 void  __attribute__((export_name("TS_Splice_set_chain_hash"))) TS_Splice_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43868         LDKSplice this_ptr_conv;
43869         this_ptr_conv.inner = untag_ptr(this_ptr);
43870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43872         this_ptr_conv.is_owned = false;
43873         LDKThirtyTwoBytes val_ref;
43874         CHECK(val->arr_len == 32);
43875         memcpy(val_ref.data, val->elems, 32); FREE(val);
43876         Splice_set_chain_hash(&this_ptr_conv, val_ref);
43877 }
43878
43879 int64_t  __attribute__((export_name("TS_Splice_get_relative_satoshis"))) TS_Splice_get_relative_satoshis(uint64_t this_ptr) {
43880         LDKSplice this_ptr_conv;
43881         this_ptr_conv.inner = untag_ptr(this_ptr);
43882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43884         this_ptr_conv.is_owned = false;
43885         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
43886         return ret_conv;
43887 }
43888
43889 void  __attribute__((export_name("TS_Splice_set_relative_satoshis"))) TS_Splice_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
43890         LDKSplice this_ptr_conv;
43891         this_ptr_conv.inner = untag_ptr(this_ptr);
43892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43894         this_ptr_conv.is_owned = false;
43895         Splice_set_relative_satoshis(&this_ptr_conv, val);
43896 }
43897
43898 int32_t  __attribute__((export_name("TS_Splice_get_funding_feerate_perkw"))) TS_Splice_get_funding_feerate_perkw(uint64_t this_ptr) {
43899         LDKSplice this_ptr_conv;
43900         this_ptr_conv.inner = untag_ptr(this_ptr);
43901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43903         this_ptr_conv.is_owned = false;
43904         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
43905         return ret_conv;
43906 }
43907
43908 void  __attribute__((export_name("TS_Splice_set_funding_feerate_perkw"))) TS_Splice_set_funding_feerate_perkw(uint64_t this_ptr, int32_t val) {
43909         LDKSplice this_ptr_conv;
43910         this_ptr_conv.inner = untag_ptr(this_ptr);
43911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43913         this_ptr_conv.is_owned = false;
43914         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
43915 }
43916
43917 int32_t  __attribute__((export_name("TS_Splice_get_locktime"))) TS_Splice_get_locktime(uint64_t this_ptr) {
43918         LDKSplice this_ptr_conv;
43919         this_ptr_conv.inner = untag_ptr(this_ptr);
43920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43922         this_ptr_conv.is_owned = false;
43923         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
43924         return ret_conv;
43925 }
43926
43927 void  __attribute__((export_name("TS_Splice_set_locktime"))) TS_Splice_set_locktime(uint64_t this_ptr, int32_t val) {
43928         LDKSplice this_ptr_conv;
43929         this_ptr_conv.inner = untag_ptr(this_ptr);
43930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43932         this_ptr_conv.is_owned = false;
43933         Splice_set_locktime(&this_ptr_conv, val);
43934 }
43935
43936 int8_tArray  __attribute__((export_name("TS_Splice_get_funding_pubkey"))) TS_Splice_get_funding_pubkey(uint64_t this_ptr) {
43937         LDKSplice this_ptr_conv;
43938         this_ptr_conv.inner = untag_ptr(this_ptr);
43939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43941         this_ptr_conv.is_owned = false;
43942         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43943         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
43944         return ret_arr;
43945 }
43946
43947 void  __attribute__((export_name("TS_Splice_set_funding_pubkey"))) TS_Splice_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
43948         LDKSplice this_ptr_conv;
43949         this_ptr_conv.inner = untag_ptr(this_ptr);
43950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43952         this_ptr_conv.is_owned = false;
43953         LDKPublicKey val_ref;
43954         CHECK(val->arr_len == 33);
43955         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43956         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
43957 }
43958
43959 uint64_t  __attribute__((export_name("TS_Splice_new"))) TS_Splice_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
43960         LDKThirtyTwoBytes channel_id_arg_ref;
43961         CHECK(channel_id_arg->arr_len == 32);
43962         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43963         LDKThirtyTwoBytes chain_hash_arg_ref;
43964         CHECK(chain_hash_arg->arr_len == 32);
43965         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43966         LDKPublicKey funding_pubkey_arg_ref;
43967         CHECK(funding_pubkey_arg->arr_len == 33);
43968         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43969         LDKSplice ret_var = Splice_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
43970         uint64_t ret_ref = 0;
43971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43973         return ret_ref;
43974 }
43975
43976 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
43977         LDKSplice ret_var = Splice_clone(arg);
43978         uint64_t ret_ref = 0;
43979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43981         return ret_ref;
43982 }
43983 int64_t  __attribute__((export_name("TS_Splice_clone_ptr"))) TS_Splice_clone_ptr(uint64_t arg) {
43984         LDKSplice arg_conv;
43985         arg_conv.inner = untag_ptr(arg);
43986         arg_conv.is_owned = ptr_is_owned(arg);
43987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43988         arg_conv.is_owned = false;
43989         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
43990         return ret_conv;
43991 }
43992
43993 uint64_t  __attribute__((export_name("TS_Splice_clone"))) TS_Splice_clone(uint64_t orig) {
43994         LDKSplice orig_conv;
43995         orig_conv.inner = untag_ptr(orig);
43996         orig_conv.is_owned = ptr_is_owned(orig);
43997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43998         orig_conv.is_owned = false;
43999         LDKSplice ret_var = Splice_clone(&orig_conv);
44000         uint64_t ret_ref = 0;
44001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44003         return ret_ref;
44004 }
44005
44006 jboolean  __attribute__((export_name("TS_Splice_eq"))) TS_Splice_eq(uint64_t a, uint64_t b) {
44007         LDKSplice a_conv;
44008         a_conv.inner = untag_ptr(a);
44009         a_conv.is_owned = ptr_is_owned(a);
44010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44011         a_conv.is_owned = false;
44012         LDKSplice b_conv;
44013         b_conv.inner = untag_ptr(b);
44014         b_conv.is_owned = ptr_is_owned(b);
44015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44016         b_conv.is_owned = false;
44017         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
44018         return ret_conv;
44019 }
44020
44021 void  __attribute__((export_name("TS_SpliceAck_free"))) TS_SpliceAck_free(uint64_t this_obj) {
44022         LDKSpliceAck this_obj_conv;
44023         this_obj_conv.inner = untag_ptr(this_obj);
44024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44026         SpliceAck_free(this_obj_conv);
44027 }
44028
44029 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_channel_id"))) TS_SpliceAck_get_channel_id(uint64_t this_ptr) {
44030         LDKSpliceAck this_ptr_conv;
44031         this_ptr_conv.inner = untag_ptr(this_ptr);
44032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44034         this_ptr_conv.is_owned = false;
44035         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44036         memcpy(ret_arr->elems, *SpliceAck_get_channel_id(&this_ptr_conv), 32);
44037         return ret_arr;
44038 }
44039
44040 void  __attribute__((export_name("TS_SpliceAck_set_channel_id"))) TS_SpliceAck_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44041         LDKSpliceAck this_ptr_conv;
44042         this_ptr_conv.inner = untag_ptr(this_ptr);
44043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44045         this_ptr_conv.is_owned = false;
44046         LDKThirtyTwoBytes val_ref;
44047         CHECK(val->arr_len == 32);
44048         memcpy(val_ref.data, val->elems, 32); FREE(val);
44049         SpliceAck_set_channel_id(&this_ptr_conv, val_ref);
44050 }
44051
44052 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_chain_hash"))) TS_SpliceAck_get_chain_hash(uint64_t this_ptr) {
44053         LDKSpliceAck this_ptr_conv;
44054         this_ptr_conv.inner = untag_ptr(this_ptr);
44055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44057         this_ptr_conv.is_owned = false;
44058         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44059         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
44060         return ret_arr;
44061 }
44062
44063 void  __attribute__((export_name("TS_SpliceAck_set_chain_hash"))) TS_SpliceAck_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44064         LDKSpliceAck this_ptr_conv;
44065         this_ptr_conv.inner = untag_ptr(this_ptr);
44066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44068         this_ptr_conv.is_owned = false;
44069         LDKThirtyTwoBytes val_ref;
44070         CHECK(val->arr_len == 32);
44071         memcpy(val_ref.data, val->elems, 32); FREE(val);
44072         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
44073 }
44074
44075 int64_t  __attribute__((export_name("TS_SpliceAck_get_relative_satoshis"))) TS_SpliceAck_get_relative_satoshis(uint64_t this_ptr) {
44076         LDKSpliceAck this_ptr_conv;
44077         this_ptr_conv.inner = untag_ptr(this_ptr);
44078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44080         this_ptr_conv.is_owned = false;
44081         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
44082         return ret_conv;
44083 }
44084
44085 void  __attribute__((export_name("TS_SpliceAck_set_relative_satoshis"))) TS_SpliceAck_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
44086         LDKSpliceAck this_ptr_conv;
44087         this_ptr_conv.inner = untag_ptr(this_ptr);
44088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44090         this_ptr_conv.is_owned = false;
44091         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
44092 }
44093
44094 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_funding_pubkey"))) TS_SpliceAck_get_funding_pubkey(uint64_t this_ptr) {
44095         LDKSpliceAck this_ptr_conv;
44096         this_ptr_conv.inner = untag_ptr(this_ptr);
44097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44099         this_ptr_conv.is_owned = false;
44100         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44101         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44102         return ret_arr;
44103 }
44104
44105 void  __attribute__((export_name("TS_SpliceAck_set_funding_pubkey"))) TS_SpliceAck_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
44106         LDKSpliceAck this_ptr_conv;
44107         this_ptr_conv.inner = untag_ptr(this_ptr);
44108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44110         this_ptr_conv.is_owned = false;
44111         LDKPublicKey val_ref;
44112         CHECK(val->arr_len == 33);
44113         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44114         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
44115 }
44116
44117 uint64_t  __attribute__((export_name("TS_SpliceAck_new"))) TS_SpliceAck_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
44118         LDKThirtyTwoBytes channel_id_arg_ref;
44119         CHECK(channel_id_arg->arr_len == 32);
44120         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44121         LDKThirtyTwoBytes chain_hash_arg_ref;
44122         CHECK(chain_hash_arg->arr_len == 32);
44123         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44124         LDKPublicKey funding_pubkey_arg_ref;
44125         CHECK(funding_pubkey_arg->arr_len == 33);
44126         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
44127         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
44128         uint64_t ret_ref = 0;
44129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44131         return ret_ref;
44132 }
44133
44134 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
44135         LDKSpliceAck ret_var = SpliceAck_clone(arg);
44136         uint64_t ret_ref = 0;
44137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44139         return ret_ref;
44140 }
44141 int64_t  __attribute__((export_name("TS_SpliceAck_clone_ptr"))) TS_SpliceAck_clone_ptr(uint64_t arg) {
44142         LDKSpliceAck arg_conv;
44143         arg_conv.inner = untag_ptr(arg);
44144         arg_conv.is_owned = ptr_is_owned(arg);
44145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44146         arg_conv.is_owned = false;
44147         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
44148         return ret_conv;
44149 }
44150
44151 uint64_t  __attribute__((export_name("TS_SpliceAck_clone"))) TS_SpliceAck_clone(uint64_t orig) {
44152         LDKSpliceAck orig_conv;
44153         orig_conv.inner = untag_ptr(orig);
44154         orig_conv.is_owned = ptr_is_owned(orig);
44155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44156         orig_conv.is_owned = false;
44157         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
44158         uint64_t ret_ref = 0;
44159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44161         return ret_ref;
44162 }
44163
44164 jboolean  __attribute__((export_name("TS_SpliceAck_eq"))) TS_SpliceAck_eq(uint64_t a, uint64_t b) {
44165         LDKSpliceAck a_conv;
44166         a_conv.inner = untag_ptr(a);
44167         a_conv.is_owned = ptr_is_owned(a);
44168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44169         a_conv.is_owned = false;
44170         LDKSpliceAck b_conv;
44171         b_conv.inner = untag_ptr(b);
44172         b_conv.is_owned = ptr_is_owned(b);
44173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44174         b_conv.is_owned = false;
44175         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
44176         return ret_conv;
44177 }
44178
44179 void  __attribute__((export_name("TS_SpliceLocked_free"))) TS_SpliceLocked_free(uint64_t this_obj) {
44180         LDKSpliceLocked this_obj_conv;
44181         this_obj_conv.inner = untag_ptr(this_obj);
44182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44184         SpliceLocked_free(this_obj_conv);
44185 }
44186
44187 int8_tArray  __attribute__((export_name("TS_SpliceLocked_get_channel_id"))) TS_SpliceLocked_get_channel_id(uint64_t this_ptr) {
44188         LDKSpliceLocked this_ptr_conv;
44189         this_ptr_conv.inner = untag_ptr(this_ptr);
44190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44192         this_ptr_conv.is_owned = false;
44193         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44194         memcpy(ret_arr->elems, *SpliceLocked_get_channel_id(&this_ptr_conv), 32);
44195         return ret_arr;
44196 }
44197
44198 void  __attribute__((export_name("TS_SpliceLocked_set_channel_id"))) TS_SpliceLocked_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44199         LDKSpliceLocked this_ptr_conv;
44200         this_ptr_conv.inner = untag_ptr(this_ptr);
44201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44203         this_ptr_conv.is_owned = false;
44204         LDKThirtyTwoBytes val_ref;
44205         CHECK(val->arr_len == 32);
44206         memcpy(val_ref.data, val->elems, 32); FREE(val);
44207         SpliceLocked_set_channel_id(&this_ptr_conv, val_ref);
44208 }
44209
44210 uint64_t  __attribute__((export_name("TS_SpliceLocked_new"))) TS_SpliceLocked_new(int8_tArray channel_id_arg) {
44211         LDKThirtyTwoBytes channel_id_arg_ref;
44212         CHECK(channel_id_arg->arr_len == 32);
44213         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44214         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_ref);
44215         uint64_t ret_ref = 0;
44216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44218         return ret_ref;
44219 }
44220
44221 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
44222         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
44223         uint64_t ret_ref = 0;
44224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44226         return ret_ref;
44227 }
44228 int64_t  __attribute__((export_name("TS_SpliceLocked_clone_ptr"))) TS_SpliceLocked_clone_ptr(uint64_t arg) {
44229         LDKSpliceLocked arg_conv;
44230         arg_conv.inner = untag_ptr(arg);
44231         arg_conv.is_owned = ptr_is_owned(arg);
44232         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44233         arg_conv.is_owned = false;
44234         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
44235         return ret_conv;
44236 }
44237
44238 uint64_t  __attribute__((export_name("TS_SpliceLocked_clone"))) TS_SpliceLocked_clone(uint64_t orig) {
44239         LDKSpliceLocked orig_conv;
44240         orig_conv.inner = untag_ptr(orig);
44241         orig_conv.is_owned = ptr_is_owned(orig);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44243         orig_conv.is_owned = false;
44244         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
44245         uint64_t ret_ref = 0;
44246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44248         return ret_ref;
44249 }
44250
44251 jboolean  __attribute__((export_name("TS_SpliceLocked_eq"))) TS_SpliceLocked_eq(uint64_t a, uint64_t b) {
44252         LDKSpliceLocked a_conv;
44253         a_conv.inner = untag_ptr(a);
44254         a_conv.is_owned = ptr_is_owned(a);
44255         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44256         a_conv.is_owned = false;
44257         LDKSpliceLocked b_conv;
44258         b_conv.inner = untag_ptr(b);
44259         b_conv.is_owned = ptr_is_owned(b);
44260         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44261         b_conv.is_owned = false;
44262         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
44263         return ret_conv;
44264 }
44265
44266 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
44267         LDKTxAddInput this_obj_conv;
44268         this_obj_conv.inner = untag_ptr(this_obj);
44269         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44271         TxAddInput_free(this_obj_conv);
44272 }
44273
44274 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
44275         LDKTxAddInput this_ptr_conv;
44276         this_ptr_conv.inner = untag_ptr(this_ptr);
44277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44279         this_ptr_conv.is_owned = false;
44280         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44281         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
44282         return ret_arr;
44283 }
44284
44285 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44286         LDKTxAddInput this_ptr_conv;
44287         this_ptr_conv.inner = untag_ptr(this_ptr);
44288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44290         this_ptr_conv.is_owned = false;
44291         LDKThirtyTwoBytes val_ref;
44292         CHECK(val->arr_len == 32);
44293         memcpy(val_ref.data, val->elems, 32); FREE(val);
44294         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
44295 }
44296
44297 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
44298         LDKTxAddInput this_ptr_conv;
44299         this_ptr_conv.inner = untag_ptr(this_ptr);
44300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44302         this_ptr_conv.is_owned = false;
44303         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
44304         return ret_conv;
44305 }
44306
44307 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
44308         LDKTxAddInput this_ptr_conv;
44309         this_ptr_conv.inner = untag_ptr(this_ptr);
44310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44312         this_ptr_conv.is_owned = false;
44313         TxAddInput_set_serial_id(&this_ptr_conv, val);
44314 }
44315
44316 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
44317         LDKTxAddInput this_ptr_conv;
44318         this_ptr_conv.inner = untag_ptr(this_ptr);
44319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44321         this_ptr_conv.is_owned = false;
44322         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
44323         uint64_t ret_ref = 0;
44324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44326         return ret_ref;
44327 }
44328
44329 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
44330         LDKTxAddInput this_ptr_conv;
44331         this_ptr_conv.inner = untag_ptr(this_ptr);
44332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44334         this_ptr_conv.is_owned = false;
44335         LDKTransactionU16LenLimited val_conv;
44336         val_conv.inner = untag_ptr(val);
44337         val_conv.is_owned = ptr_is_owned(val);
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44339         val_conv = TransactionU16LenLimited_clone(&val_conv);
44340         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
44341 }
44342
44343 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
44344         LDKTxAddInput this_ptr_conv;
44345         this_ptr_conv.inner = untag_ptr(this_ptr);
44346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44348         this_ptr_conv.is_owned = false;
44349         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
44350         return ret_conv;
44351 }
44352
44353 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
44354         LDKTxAddInput this_ptr_conv;
44355         this_ptr_conv.inner = untag_ptr(this_ptr);
44356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44358         this_ptr_conv.is_owned = false;
44359         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
44360 }
44361
44362 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
44363         LDKTxAddInput this_ptr_conv;
44364         this_ptr_conv.inner = untag_ptr(this_ptr);
44365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44367         this_ptr_conv.is_owned = false;
44368         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
44369         return ret_conv;
44370 }
44371
44372 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
44373         LDKTxAddInput this_ptr_conv;
44374         this_ptr_conv.inner = untag_ptr(this_ptr);
44375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44377         this_ptr_conv.is_owned = false;
44378         TxAddInput_set_sequence(&this_ptr_conv, val);
44379 }
44380
44381 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) {
44382         LDKThirtyTwoBytes channel_id_arg_ref;
44383         CHECK(channel_id_arg->arr_len == 32);
44384         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44385         LDKTransactionU16LenLimited prevtx_arg_conv;
44386         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
44387         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
44388         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
44389         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
44390         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
44391         uint64_t ret_ref = 0;
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44394         return ret_ref;
44395 }
44396
44397 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
44398         LDKTxAddInput ret_var = TxAddInput_clone(arg);
44399         uint64_t ret_ref = 0;
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44402         return ret_ref;
44403 }
44404 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
44405         LDKTxAddInput arg_conv;
44406         arg_conv.inner = untag_ptr(arg);
44407         arg_conv.is_owned = ptr_is_owned(arg);
44408         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44409         arg_conv.is_owned = false;
44410         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
44411         return ret_conv;
44412 }
44413
44414 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
44415         LDKTxAddInput orig_conv;
44416         orig_conv.inner = untag_ptr(orig);
44417         orig_conv.is_owned = ptr_is_owned(orig);
44418         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44419         orig_conv.is_owned = false;
44420         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
44421         uint64_t ret_ref = 0;
44422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44424         return ret_ref;
44425 }
44426
44427 int64_t  __attribute__((export_name("TS_TxAddInput_hash"))) TS_TxAddInput_hash(uint64_t o) {
44428         LDKTxAddInput o_conv;
44429         o_conv.inner = untag_ptr(o);
44430         o_conv.is_owned = ptr_is_owned(o);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44432         o_conv.is_owned = false;
44433         int64_t ret_conv = TxAddInput_hash(&o_conv);
44434         return ret_conv;
44435 }
44436
44437 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
44438         LDKTxAddInput a_conv;
44439         a_conv.inner = untag_ptr(a);
44440         a_conv.is_owned = ptr_is_owned(a);
44441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44442         a_conv.is_owned = false;
44443         LDKTxAddInput b_conv;
44444         b_conv.inner = untag_ptr(b);
44445         b_conv.is_owned = ptr_is_owned(b);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44447         b_conv.is_owned = false;
44448         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
44449         return ret_conv;
44450 }
44451
44452 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
44453         LDKTxAddOutput this_obj_conv;
44454         this_obj_conv.inner = untag_ptr(this_obj);
44455         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44457         TxAddOutput_free(this_obj_conv);
44458 }
44459
44460 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
44461         LDKTxAddOutput this_ptr_conv;
44462         this_ptr_conv.inner = untag_ptr(this_ptr);
44463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44465         this_ptr_conv.is_owned = false;
44466         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44467         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
44468         return ret_arr;
44469 }
44470
44471 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44472         LDKTxAddOutput this_ptr_conv;
44473         this_ptr_conv.inner = untag_ptr(this_ptr);
44474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44476         this_ptr_conv.is_owned = false;
44477         LDKThirtyTwoBytes val_ref;
44478         CHECK(val->arr_len == 32);
44479         memcpy(val_ref.data, val->elems, 32); FREE(val);
44480         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
44481 }
44482
44483 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
44484         LDKTxAddOutput this_ptr_conv;
44485         this_ptr_conv.inner = untag_ptr(this_ptr);
44486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44488         this_ptr_conv.is_owned = false;
44489         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
44490         return ret_conv;
44491 }
44492
44493 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
44494         LDKTxAddOutput this_ptr_conv;
44495         this_ptr_conv.inner = untag_ptr(this_ptr);
44496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44498         this_ptr_conv.is_owned = false;
44499         TxAddOutput_set_serial_id(&this_ptr_conv, val);
44500 }
44501
44502 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
44503         LDKTxAddOutput this_ptr_conv;
44504         this_ptr_conv.inner = untag_ptr(this_ptr);
44505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44507         this_ptr_conv.is_owned = false;
44508         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
44509         return ret_conv;
44510 }
44511
44512 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
44513         LDKTxAddOutput this_ptr_conv;
44514         this_ptr_conv.inner = untag_ptr(this_ptr);
44515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44517         this_ptr_conv.is_owned = false;
44518         TxAddOutput_set_sats(&this_ptr_conv, val);
44519 }
44520
44521 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
44522         LDKTxAddOutput this_ptr_conv;
44523         this_ptr_conv.inner = untag_ptr(this_ptr);
44524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44526         this_ptr_conv.is_owned = false;
44527         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
44528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44530         CVec_u8Z_free(ret_var);
44531         return ret_arr;
44532 }
44533
44534 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
44535         LDKTxAddOutput this_ptr_conv;
44536         this_ptr_conv.inner = untag_ptr(this_ptr);
44537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44539         this_ptr_conv.is_owned = false;
44540         LDKCVec_u8Z val_ref;
44541         val_ref.datalen = val->arr_len;
44542         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44543         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
44544         TxAddOutput_set_script(&this_ptr_conv, val_ref);
44545 }
44546
44547 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) {
44548         LDKThirtyTwoBytes channel_id_arg_ref;
44549         CHECK(channel_id_arg->arr_len == 32);
44550         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44551         LDKCVec_u8Z script_arg_ref;
44552         script_arg_ref.datalen = script_arg->arr_len;
44553         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44554         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
44555         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
44556         uint64_t ret_ref = 0;
44557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44559         return ret_ref;
44560 }
44561
44562 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
44563         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
44564         uint64_t ret_ref = 0;
44565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44567         return ret_ref;
44568 }
44569 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
44570         LDKTxAddOutput arg_conv;
44571         arg_conv.inner = untag_ptr(arg);
44572         arg_conv.is_owned = ptr_is_owned(arg);
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44574         arg_conv.is_owned = false;
44575         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
44576         return ret_conv;
44577 }
44578
44579 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
44580         LDKTxAddOutput orig_conv;
44581         orig_conv.inner = untag_ptr(orig);
44582         orig_conv.is_owned = ptr_is_owned(orig);
44583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44584         orig_conv.is_owned = false;
44585         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
44586         uint64_t ret_ref = 0;
44587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44589         return ret_ref;
44590 }
44591
44592 int64_t  __attribute__((export_name("TS_TxAddOutput_hash"))) TS_TxAddOutput_hash(uint64_t o) {
44593         LDKTxAddOutput o_conv;
44594         o_conv.inner = untag_ptr(o);
44595         o_conv.is_owned = ptr_is_owned(o);
44596         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44597         o_conv.is_owned = false;
44598         int64_t ret_conv = TxAddOutput_hash(&o_conv);
44599         return ret_conv;
44600 }
44601
44602 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
44603         LDKTxAddOutput a_conv;
44604         a_conv.inner = untag_ptr(a);
44605         a_conv.is_owned = ptr_is_owned(a);
44606         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44607         a_conv.is_owned = false;
44608         LDKTxAddOutput b_conv;
44609         b_conv.inner = untag_ptr(b);
44610         b_conv.is_owned = ptr_is_owned(b);
44611         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44612         b_conv.is_owned = false;
44613         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
44614         return ret_conv;
44615 }
44616
44617 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
44618         LDKTxRemoveInput this_obj_conv;
44619         this_obj_conv.inner = untag_ptr(this_obj);
44620         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44622         TxRemoveInput_free(this_obj_conv);
44623 }
44624
44625 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
44626         LDKTxRemoveInput this_ptr_conv;
44627         this_ptr_conv.inner = untag_ptr(this_ptr);
44628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44630         this_ptr_conv.is_owned = false;
44631         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44632         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
44633         return ret_arr;
44634 }
44635
44636 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44637         LDKTxRemoveInput this_ptr_conv;
44638         this_ptr_conv.inner = untag_ptr(this_ptr);
44639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44641         this_ptr_conv.is_owned = false;
44642         LDKThirtyTwoBytes val_ref;
44643         CHECK(val->arr_len == 32);
44644         memcpy(val_ref.data, val->elems, 32); FREE(val);
44645         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
44646 }
44647
44648 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
44649         LDKTxRemoveInput this_ptr_conv;
44650         this_ptr_conv.inner = untag_ptr(this_ptr);
44651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44653         this_ptr_conv.is_owned = false;
44654         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
44655         return ret_conv;
44656 }
44657
44658 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
44659         LDKTxRemoveInput this_ptr_conv;
44660         this_ptr_conv.inner = untag_ptr(this_ptr);
44661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44663         this_ptr_conv.is_owned = false;
44664         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
44665 }
44666
44667 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
44668         LDKThirtyTwoBytes channel_id_arg_ref;
44669         CHECK(channel_id_arg->arr_len == 32);
44670         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44671         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
44672         uint64_t ret_ref = 0;
44673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44675         return ret_ref;
44676 }
44677
44678 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
44679         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
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 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
44686         LDKTxRemoveInput arg_conv;
44687         arg_conv.inner = untag_ptr(arg);
44688         arg_conv.is_owned = ptr_is_owned(arg);
44689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44690         arg_conv.is_owned = false;
44691         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
44692         return ret_conv;
44693 }
44694
44695 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
44696         LDKTxRemoveInput orig_conv;
44697         orig_conv.inner = untag_ptr(orig);
44698         orig_conv.is_owned = ptr_is_owned(orig);
44699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44700         orig_conv.is_owned = false;
44701         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
44702         uint64_t ret_ref = 0;
44703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44705         return ret_ref;
44706 }
44707
44708 int64_t  __attribute__((export_name("TS_TxRemoveInput_hash"))) TS_TxRemoveInput_hash(uint64_t o) {
44709         LDKTxRemoveInput o_conv;
44710         o_conv.inner = untag_ptr(o);
44711         o_conv.is_owned = ptr_is_owned(o);
44712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44713         o_conv.is_owned = false;
44714         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
44715         return ret_conv;
44716 }
44717
44718 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
44719         LDKTxRemoveInput a_conv;
44720         a_conv.inner = untag_ptr(a);
44721         a_conv.is_owned = ptr_is_owned(a);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44723         a_conv.is_owned = false;
44724         LDKTxRemoveInput b_conv;
44725         b_conv.inner = untag_ptr(b);
44726         b_conv.is_owned = ptr_is_owned(b);
44727         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44728         b_conv.is_owned = false;
44729         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
44730         return ret_conv;
44731 }
44732
44733 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
44734         LDKTxRemoveOutput this_obj_conv;
44735         this_obj_conv.inner = untag_ptr(this_obj);
44736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44738         TxRemoveOutput_free(this_obj_conv);
44739 }
44740
44741 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
44742         LDKTxRemoveOutput this_ptr_conv;
44743         this_ptr_conv.inner = untag_ptr(this_ptr);
44744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44746         this_ptr_conv.is_owned = false;
44747         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44748         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
44749         return ret_arr;
44750 }
44751
44752 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44753         LDKTxRemoveOutput this_ptr_conv;
44754         this_ptr_conv.inner = untag_ptr(this_ptr);
44755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44757         this_ptr_conv.is_owned = false;
44758         LDKThirtyTwoBytes val_ref;
44759         CHECK(val->arr_len == 32);
44760         memcpy(val_ref.data, val->elems, 32); FREE(val);
44761         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
44762 }
44763
44764 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
44765         LDKTxRemoveOutput this_ptr_conv;
44766         this_ptr_conv.inner = untag_ptr(this_ptr);
44767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44769         this_ptr_conv.is_owned = false;
44770         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
44771         return ret_conv;
44772 }
44773
44774 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
44775         LDKTxRemoveOutput this_ptr_conv;
44776         this_ptr_conv.inner = untag_ptr(this_ptr);
44777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44779         this_ptr_conv.is_owned = false;
44780         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
44781 }
44782
44783 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
44784         LDKThirtyTwoBytes channel_id_arg_ref;
44785         CHECK(channel_id_arg->arr_len == 32);
44786         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44787         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
44788         uint64_t ret_ref = 0;
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44791         return ret_ref;
44792 }
44793
44794 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
44795         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
44796         uint64_t ret_ref = 0;
44797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44799         return ret_ref;
44800 }
44801 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
44802         LDKTxRemoveOutput arg_conv;
44803         arg_conv.inner = untag_ptr(arg);
44804         arg_conv.is_owned = ptr_is_owned(arg);
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44806         arg_conv.is_owned = false;
44807         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
44808         return ret_conv;
44809 }
44810
44811 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
44812         LDKTxRemoveOutput orig_conv;
44813         orig_conv.inner = untag_ptr(orig);
44814         orig_conv.is_owned = ptr_is_owned(orig);
44815         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44816         orig_conv.is_owned = false;
44817         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
44818         uint64_t ret_ref = 0;
44819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44821         return ret_ref;
44822 }
44823
44824 int64_t  __attribute__((export_name("TS_TxRemoveOutput_hash"))) TS_TxRemoveOutput_hash(uint64_t o) {
44825         LDKTxRemoveOutput o_conv;
44826         o_conv.inner = untag_ptr(o);
44827         o_conv.is_owned = ptr_is_owned(o);
44828         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44829         o_conv.is_owned = false;
44830         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
44831         return ret_conv;
44832 }
44833
44834 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
44835         LDKTxRemoveOutput a_conv;
44836         a_conv.inner = untag_ptr(a);
44837         a_conv.is_owned = ptr_is_owned(a);
44838         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44839         a_conv.is_owned = false;
44840         LDKTxRemoveOutput b_conv;
44841         b_conv.inner = untag_ptr(b);
44842         b_conv.is_owned = ptr_is_owned(b);
44843         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44844         b_conv.is_owned = false;
44845         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
44846         return ret_conv;
44847 }
44848
44849 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
44850         LDKTxComplete this_obj_conv;
44851         this_obj_conv.inner = untag_ptr(this_obj);
44852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44854         TxComplete_free(this_obj_conv);
44855 }
44856
44857 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
44858         LDKTxComplete this_ptr_conv;
44859         this_ptr_conv.inner = untag_ptr(this_ptr);
44860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44862         this_ptr_conv.is_owned = false;
44863         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44864         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
44865         return ret_arr;
44866 }
44867
44868 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44869         LDKTxComplete 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         LDKThirtyTwoBytes val_ref;
44875         CHECK(val->arr_len == 32);
44876         memcpy(val_ref.data, val->elems, 32); FREE(val);
44877         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
44878 }
44879
44880 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
44881         LDKThirtyTwoBytes channel_id_arg_ref;
44882         CHECK(channel_id_arg->arr_len == 32);
44883         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44884         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
44885         uint64_t ret_ref = 0;
44886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44888         return ret_ref;
44889 }
44890
44891 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
44892         LDKTxComplete ret_var = TxComplete_clone(arg);
44893         uint64_t ret_ref = 0;
44894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44896         return ret_ref;
44897 }
44898 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
44899         LDKTxComplete arg_conv;
44900         arg_conv.inner = untag_ptr(arg);
44901         arg_conv.is_owned = ptr_is_owned(arg);
44902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44903         arg_conv.is_owned = false;
44904         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
44905         return ret_conv;
44906 }
44907
44908 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
44909         LDKTxComplete orig_conv;
44910         orig_conv.inner = untag_ptr(orig);
44911         orig_conv.is_owned = ptr_is_owned(orig);
44912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44913         orig_conv.is_owned = false;
44914         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
44915         uint64_t ret_ref = 0;
44916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44918         return ret_ref;
44919 }
44920
44921 int64_t  __attribute__((export_name("TS_TxComplete_hash"))) TS_TxComplete_hash(uint64_t o) {
44922         LDKTxComplete o_conv;
44923         o_conv.inner = untag_ptr(o);
44924         o_conv.is_owned = ptr_is_owned(o);
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44926         o_conv.is_owned = false;
44927         int64_t ret_conv = TxComplete_hash(&o_conv);
44928         return ret_conv;
44929 }
44930
44931 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
44932         LDKTxComplete a_conv;
44933         a_conv.inner = untag_ptr(a);
44934         a_conv.is_owned = ptr_is_owned(a);
44935         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44936         a_conv.is_owned = false;
44937         LDKTxComplete b_conv;
44938         b_conv.inner = untag_ptr(b);
44939         b_conv.is_owned = ptr_is_owned(b);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44941         b_conv.is_owned = false;
44942         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
44943         return ret_conv;
44944 }
44945
44946 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
44947         LDKTxSignatures this_obj_conv;
44948         this_obj_conv.inner = untag_ptr(this_obj);
44949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44951         TxSignatures_free(this_obj_conv);
44952 }
44953
44954 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
44955         LDKTxSignatures this_ptr_conv;
44956         this_ptr_conv.inner = untag_ptr(this_ptr);
44957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44959         this_ptr_conv.is_owned = false;
44960         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44961         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
44962         return ret_arr;
44963 }
44964
44965 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44966         LDKTxSignatures this_ptr_conv;
44967         this_ptr_conv.inner = untag_ptr(this_ptr);
44968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44970         this_ptr_conv.is_owned = false;
44971         LDKThirtyTwoBytes val_ref;
44972         CHECK(val->arr_len == 32);
44973         memcpy(val_ref.data, val->elems, 32); FREE(val);
44974         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
44975 }
44976
44977 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
44978         LDKTxSignatures this_ptr_conv;
44979         this_ptr_conv.inner = untag_ptr(this_ptr);
44980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44982         this_ptr_conv.is_owned = false;
44983         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44984         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
44985         return ret_arr;
44986 }
44987
44988 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
44989         LDKTxSignatures this_ptr_conv;
44990         this_ptr_conv.inner = untag_ptr(this_ptr);
44991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44993         this_ptr_conv.is_owned = false;
44994         LDKThirtyTwoBytes val_ref;
44995         CHECK(val->arr_len == 32);
44996         memcpy(val_ref.data, val->elems, 32); FREE(val);
44997         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
44998 }
44999
45000 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
45001         LDKTxSignatures this_ptr_conv;
45002         this_ptr_conv.inner = untag_ptr(this_ptr);
45003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45005         this_ptr_conv.is_owned = false;
45006         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45007         ptrArray ret_arr = NULL;
45008         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
45009         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
45010         for (size_t m = 0; m < ret_var.datalen; m++) {
45011                 LDKWitness ret_conv_12_var = ret_var.data[m];
45012                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
45013                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
45014                 Witness_free(ret_conv_12_var);
45015                 ret_arr_ptr[m] = ret_conv_12_arr;
45016         }
45017         
45018         FREE(ret_var.data);
45019         return ret_arr;
45020 }
45021
45022 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
45023         LDKTxSignatures this_ptr_conv;
45024         this_ptr_conv.inner = untag_ptr(this_ptr);
45025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45027         this_ptr_conv.is_owned = false;
45028         LDKCVec_WitnessZ val_constr;
45029         val_constr.datalen = val->arr_len;
45030         if (val_constr.datalen > 0)
45031                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45032         else
45033                 val_constr.data = NULL;
45034         int8_tArray* val_vals = (void*) val->elems;
45035         for (size_t m = 0; m < val_constr.datalen; m++) {
45036                 int8_tArray val_conv_12 = val_vals[m];
45037                 LDKWitness val_conv_12_ref;
45038                 val_conv_12_ref.datalen = val_conv_12->arr_len;
45039                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
45040                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
45041                 val_conv_12_ref.data_is_owned = true;
45042                 val_constr.data[m] = val_conv_12_ref;
45043         }
45044         FREE(val);
45045         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
45046 }
45047
45048 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
45049         LDKThirtyTwoBytes channel_id_arg_ref;
45050         CHECK(channel_id_arg->arr_len == 32);
45051         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45052         LDKThirtyTwoBytes tx_hash_arg_ref;
45053         CHECK(tx_hash_arg->arr_len == 32);
45054         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
45055         LDKCVec_WitnessZ witnesses_arg_constr;
45056         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
45057         if (witnesses_arg_constr.datalen > 0)
45058                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45059         else
45060                 witnesses_arg_constr.data = NULL;
45061         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
45062         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
45063                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
45064                 LDKWitness witnesses_arg_conv_12_ref;
45065                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
45066                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
45067                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
45068                 witnesses_arg_conv_12_ref.data_is_owned = true;
45069                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
45070         }
45071         FREE(witnesses_arg);
45072         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
45073         uint64_t ret_ref = 0;
45074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45076         return ret_ref;
45077 }
45078
45079 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
45080         LDKTxSignatures ret_var = TxSignatures_clone(arg);
45081         uint64_t ret_ref = 0;
45082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45084         return ret_ref;
45085 }
45086 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
45087         LDKTxSignatures arg_conv;
45088         arg_conv.inner = untag_ptr(arg);
45089         arg_conv.is_owned = ptr_is_owned(arg);
45090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45091         arg_conv.is_owned = false;
45092         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
45093         return ret_conv;
45094 }
45095
45096 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
45097         LDKTxSignatures orig_conv;
45098         orig_conv.inner = untag_ptr(orig);
45099         orig_conv.is_owned = ptr_is_owned(orig);
45100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45101         orig_conv.is_owned = false;
45102         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
45103         uint64_t ret_ref = 0;
45104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45106         return ret_ref;
45107 }
45108
45109 int64_t  __attribute__((export_name("TS_TxSignatures_hash"))) TS_TxSignatures_hash(uint64_t o) {
45110         LDKTxSignatures o_conv;
45111         o_conv.inner = untag_ptr(o);
45112         o_conv.is_owned = ptr_is_owned(o);
45113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45114         o_conv.is_owned = false;
45115         int64_t ret_conv = TxSignatures_hash(&o_conv);
45116         return ret_conv;
45117 }
45118
45119 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
45120         LDKTxSignatures a_conv;
45121         a_conv.inner = untag_ptr(a);
45122         a_conv.is_owned = ptr_is_owned(a);
45123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45124         a_conv.is_owned = false;
45125         LDKTxSignatures b_conv;
45126         b_conv.inner = untag_ptr(b);
45127         b_conv.is_owned = ptr_is_owned(b);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45129         b_conv.is_owned = false;
45130         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
45131         return ret_conv;
45132 }
45133
45134 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
45135         LDKTxInitRbf this_obj_conv;
45136         this_obj_conv.inner = untag_ptr(this_obj);
45137         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45139         TxInitRbf_free(this_obj_conv);
45140 }
45141
45142 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
45143         LDKTxInitRbf this_ptr_conv;
45144         this_ptr_conv.inner = untag_ptr(this_ptr);
45145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45147         this_ptr_conv.is_owned = false;
45148         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45149         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
45150         return ret_arr;
45151 }
45152
45153 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45154         LDKTxInitRbf this_ptr_conv;
45155         this_ptr_conv.inner = untag_ptr(this_ptr);
45156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45158         this_ptr_conv.is_owned = false;
45159         LDKThirtyTwoBytes val_ref;
45160         CHECK(val->arr_len == 32);
45161         memcpy(val_ref.data, val->elems, 32); FREE(val);
45162         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
45163 }
45164
45165 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
45166         LDKTxInitRbf this_ptr_conv;
45167         this_ptr_conv.inner = untag_ptr(this_ptr);
45168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45170         this_ptr_conv.is_owned = false;
45171         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
45172         return ret_conv;
45173 }
45174
45175 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
45176         LDKTxInitRbf this_ptr_conv;
45177         this_ptr_conv.inner = untag_ptr(this_ptr);
45178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45180         this_ptr_conv.is_owned = false;
45181         TxInitRbf_set_locktime(&this_ptr_conv, val);
45182 }
45183
45184 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) {
45185         LDKTxInitRbf this_ptr_conv;
45186         this_ptr_conv.inner = untag_ptr(this_ptr);
45187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45189         this_ptr_conv.is_owned = false;
45190         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45191         return ret_conv;
45192 }
45193
45194 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) {
45195         LDKTxInitRbf this_ptr_conv;
45196         this_ptr_conv.inner = untag_ptr(this_ptr);
45197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45199         this_ptr_conv.is_owned = false;
45200         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45201 }
45202
45203 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
45204         LDKTxInitRbf this_ptr_conv;
45205         this_ptr_conv.inner = untag_ptr(this_ptr);
45206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45208         this_ptr_conv.is_owned = false;
45209         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45210         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
45211         uint64_t ret_ref = tag_ptr(ret_copy, true);
45212         return ret_ref;
45213 }
45214
45215 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
45216         LDKTxInitRbf this_ptr_conv;
45217         this_ptr_conv.inner = untag_ptr(this_ptr);
45218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45220         this_ptr_conv.is_owned = false;
45221         void* val_ptr = untag_ptr(val);
45222         CHECK_ACCESS(val_ptr);
45223         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45224         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45225         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45226 }
45227
45228 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) {
45229         LDKThirtyTwoBytes channel_id_arg_ref;
45230         CHECK(channel_id_arg->arr_len == 32);
45231         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45232         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45233         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45234         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45235         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45236         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
45237         uint64_t ret_ref = 0;
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45240         return ret_ref;
45241 }
45242
45243 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
45244         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
45245         uint64_t ret_ref = 0;
45246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45248         return ret_ref;
45249 }
45250 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
45251         LDKTxInitRbf arg_conv;
45252         arg_conv.inner = untag_ptr(arg);
45253         arg_conv.is_owned = ptr_is_owned(arg);
45254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45255         arg_conv.is_owned = false;
45256         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
45257         return ret_conv;
45258 }
45259
45260 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
45261         LDKTxInitRbf orig_conv;
45262         orig_conv.inner = untag_ptr(orig);
45263         orig_conv.is_owned = ptr_is_owned(orig);
45264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45265         orig_conv.is_owned = false;
45266         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
45267         uint64_t ret_ref = 0;
45268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45270         return ret_ref;
45271 }
45272
45273 int64_t  __attribute__((export_name("TS_TxInitRbf_hash"))) TS_TxInitRbf_hash(uint64_t o) {
45274         LDKTxInitRbf o_conv;
45275         o_conv.inner = untag_ptr(o);
45276         o_conv.is_owned = ptr_is_owned(o);
45277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45278         o_conv.is_owned = false;
45279         int64_t ret_conv = TxInitRbf_hash(&o_conv);
45280         return ret_conv;
45281 }
45282
45283 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
45284         LDKTxInitRbf a_conv;
45285         a_conv.inner = untag_ptr(a);
45286         a_conv.is_owned = ptr_is_owned(a);
45287         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45288         a_conv.is_owned = false;
45289         LDKTxInitRbf b_conv;
45290         b_conv.inner = untag_ptr(b);
45291         b_conv.is_owned = ptr_is_owned(b);
45292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45293         b_conv.is_owned = false;
45294         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
45295         return ret_conv;
45296 }
45297
45298 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
45299         LDKTxAckRbf this_obj_conv;
45300         this_obj_conv.inner = untag_ptr(this_obj);
45301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45303         TxAckRbf_free(this_obj_conv);
45304 }
45305
45306 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
45307         LDKTxAckRbf this_ptr_conv;
45308         this_ptr_conv.inner = untag_ptr(this_ptr);
45309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45311         this_ptr_conv.is_owned = false;
45312         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45313         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
45314         return ret_arr;
45315 }
45316
45317 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45318         LDKTxAckRbf this_ptr_conv;
45319         this_ptr_conv.inner = untag_ptr(this_ptr);
45320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45322         this_ptr_conv.is_owned = false;
45323         LDKThirtyTwoBytes val_ref;
45324         CHECK(val->arr_len == 32);
45325         memcpy(val_ref.data, val->elems, 32); FREE(val);
45326         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
45327 }
45328
45329 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
45330         LDKTxAckRbf this_ptr_conv;
45331         this_ptr_conv.inner = untag_ptr(this_ptr);
45332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45334         this_ptr_conv.is_owned = false;
45335         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45336         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
45337         uint64_t ret_ref = tag_ptr(ret_copy, true);
45338         return ret_ref;
45339 }
45340
45341 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
45342         LDKTxAckRbf this_ptr_conv;
45343         this_ptr_conv.inner = untag_ptr(this_ptr);
45344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45346         this_ptr_conv.is_owned = false;
45347         void* val_ptr = untag_ptr(val);
45348         CHECK_ACCESS(val_ptr);
45349         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45350         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45351         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45352 }
45353
45354 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
45355         LDKThirtyTwoBytes channel_id_arg_ref;
45356         CHECK(channel_id_arg->arr_len == 32);
45357         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45358         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45359         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45360         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45361         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45362         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
45363         uint64_t ret_ref = 0;
45364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45366         return ret_ref;
45367 }
45368
45369 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
45370         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
45371         uint64_t ret_ref = 0;
45372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45374         return ret_ref;
45375 }
45376 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
45377         LDKTxAckRbf arg_conv;
45378         arg_conv.inner = untag_ptr(arg);
45379         arg_conv.is_owned = ptr_is_owned(arg);
45380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45381         arg_conv.is_owned = false;
45382         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
45383         return ret_conv;
45384 }
45385
45386 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
45387         LDKTxAckRbf orig_conv;
45388         orig_conv.inner = untag_ptr(orig);
45389         orig_conv.is_owned = ptr_is_owned(orig);
45390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45391         orig_conv.is_owned = false;
45392         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
45393         uint64_t ret_ref = 0;
45394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45396         return ret_ref;
45397 }
45398
45399 int64_t  __attribute__((export_name("TS_TxAckRbf_hash"))) TS_TxAckRbf_hash(uint64_t o) {
45400         LDKTxAckRbf o_conv;
45401         o_conv.inner = untag_ptr(o);
45402         o_conv.is_owned = ptr_is_owned(o);
45403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45404         o_conv.is_owned = false;
45405         int64_t ret_conv = TxAckRbf_hash(&o_conv);
45406         return ret_conv;
45407 }
45408
45409 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
45410         LDKTxAckRbf a_conv;
45411         a_conv.inner = untag_ptr(a);
45412         a_conv.is_owned = ptr_is_owned(a);
45413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45414         a_conv.is_owned = false;
45415         LDKTxAckRbf b_conv;
45416         b_conv.inner = untag_ptr(b);
45417         b_conv.is_owned = ptr_is_owned(b);
45418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45419         b_conv.is_owned = false;
45420         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
45421         return ret_conv;
45422 }
45423
45424 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
45425         LDKTxAbort this_obj_conv;
45426         this_obj_conv.inner = untag_ptr(this_obj);
45427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45429         TxAbort_free(this_obj_conv);
45430 }
45431
45432 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
45433         LDKTxAbort this_ptr_conv;
45434         this_ptr_conv.inner = untag_ptr(this_ptr);
45435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45437         this_ptr_conv.is_owned = false;
45438         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45439         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
45440         return ret_arr;
45441 }
45442
45443 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45444         LDKTxAbort this_ptr_conv;
45445         this_ptr_conv.inner = untag_ptr(this_ptr);
45446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45448         this_ptr_conv.is_owned = false;
45449         LDKThirtyTwoBytes val_ref;
45450         CHECK(val->arr_len == 32);
45451         memcpy(val_ref.data, val->elems, 32); FREE(val);
45452         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
45453 }
45454
45455 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
45456         LDKTxAbort this_ptr_conv;
45457         this_ptr_conv.inner = untag_ptr(this_ptr);
45458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45460         this_ptr_conv.is_owned = false;
45461         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
45462         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45463         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45464         CVec_u8Z_free(ret_var);
45465         return ret_arr;
45466 }
45467
45468 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
45469         LDKTxAbort this_ptr_conv;
45470         this_ptr_conv.inner = untag_ptr(this_ptr);
45471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45473         this_ptr_conv.is_owned = false;
45474         LDKCVec_u8Z val_ref;
45475         val_ref.datalen = val->arr_len;
45476         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45477         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45478         TxAbort_set_data(&this_ptr_conv, val_ref);
45479 }
45480
45481 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
45482         LDKThirtyTwoBytes channel_id_arg_ref;
45483         CHECK(channel_id_arg->arr_len == 32);
45484         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45485         LDKCVec_u8Z data_arg_ref;
45486         data_arg_ref.datalen = data_arg->arr_len;
45487         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45488         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
45489         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
45490         uint64_t ret_ref = 0;
45491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45493         return ret_ref;
45494 }
45495
45496 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
45497         LDKTxAbort ret_var = TxAbort_clone(arg);
45498         uint64_t ret_ref = 0;
45499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45501         return ret_ref;
45502 }
45503 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
45504         LDKTxAbort arg_conv;
45505         arg_conv.inner = untag_ptr(arg);
45506         arg_conv.is_owned = ptr_is_owned(arg);
45507         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45508         arg_conv.is_owned = false;
45509         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
45510         return ret_conv;
45511 }
45512
45513 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
45514         LDKTxAbort orig_conv;
45515         orig_conv.inner = untag_ptr(orig);
45516         orig_conv.is_owned = ptr_is_owned(orig);
45517         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45518         orig_conv.is_owned = false;
45519         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
45520         uint64_t ret_ref = 0;
45521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45523         return ret_ref;
45524 }
45525
45526 int64_t  __attribute__((export_name("TS_TxAbort_hash"))) TS_TxAbort_hash(uint64_t o) {
45527         LDKTxAbort o_conv;
45528         o_conv.inner = untag_ptr(o);
45529         o_conv.is_owned = ptr_is_owned(o);
45530         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45531         o_conv.is_owned = false;
45532         int64_t ret_conv = TxAbort_hash(&o_conv);
45533         return ret_conv;
45534 }
45535
45536 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
45537         LDKTxAbort a_conv;
45538         a_conv.inner = untag_ptr(a);
45539         a_conv.is_owned = ptr_is_owned(a);
45540         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45541         a_conv.is_owned = false;
45542         LDKTxAbort b_conv;
45543         b_conv.inner = untag_ptr(b);
45544         b_conv.is_owned = ptr_is_owned(b);
45545         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45546         b_conv.is_owned = false;
45547         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
45548         return ret_conv;
45549 }
45550
45551 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
45552         LDKShutdown this_obj_conv;
45553         this_obj_conv.inner = untag_ptr(this_obj);
45554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45556         Shutdown_free(this_obj_conv);
45557 }
45558
45559 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
45560         LDKShutdown this_ptr_conv;
45561         this_ptr_conv.inner = untag_ptr(this_ptr);
45562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45564         this_ptr_conv.is_owned = false;
45565         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45566         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
45567         return ret_arr;
45568 }
45569
45570 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45571         LDKShutdown this_ptr_conv;
45572         this_ptr_conv.inner = untag_ptr(this_ptr);
45573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45575         this_ptr_conv.is_owned = false;
45576         LDKThirtyTwoBytes val_ref;
45577         CHECK(val->arr_len == 32);
45578         memcpy(val_ref.data, val->elems, 32); FREE(val);
45579         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
45580 }
45581
45582 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
45583         LDKShutdown this_ptr_conv;
45584         this_ptr_conv.inner = untag_ptr(this_ptr);
45585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45587         this_ptr_conv.is_owned = false;
45588         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
45589         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45590         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45591         CVec_u8Z_free(ret_var);
45592         return ret_arr;
45593 }
45594
45595 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
45596         LDKShutdown this_ptr_conv;
45597         this_ptr_conv.inner = untag_ptr(this_ptr);
45598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45600         this_ptr_conv.is_owned = false;
45601         LDKCVec_u8Z val_ref;
45602         val_ref.datalen = val->arr_len;
45603         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45604         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45605         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
45606 }
45607
45608 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
45609         LDKThirtyTwoBytes channel_id_arg_ref;
45610         CHECK(channel_id_arg->arr_len == 32);
45611         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45612         LDKCVec_u8Z scriptpubkey_arg_ref;
45613         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
45614         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45615         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
45616         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
45617         uint64_t ret_ref = 0;
45618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45620         return ret_ref;
45621 }
45622
45623 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
45624         LDKShutdown ret_var = Shutdown_clone(arg);
45625         uint64_t ret_ref = 0;
45626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45628         return ret_ref;
45629 }
45630 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
45631         LDKShutdown arg_conv;
45632         arg_conv.inner = untag_ptr(arg);
45633         arg_conv.is_owned = ptr_is_owned(arg);
45634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45635         arg_conv.is_owned = false;
45636         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
45637         return ret_conv;
45638 }
45639
45640 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
45641         LDKShutdown orig_conv;
45642         orig_conv.inner = untag_ptr(orig);
45643         orig_conv.is_owned = ptr_is_owned(orig);
45644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45645         orig_conv.is_owned = false;
45646         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
45647         uint64_t ret_ref = 0;
45648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45650         return ret_ref;
45651 }
45652
45653 int64_t  __attribute__((export_name("TS_Shutdown_hash"))) TS_Shutdown_hash(uint64_t o) {
45654         LDKShutdown o_conv;
45655         o_conv.inner = untag_ptr(o);
45656         o_conv.is_owned = ptr_is_owned(o);
45657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45658         o_conv.is_owned = false;
45659         int64_t ret_conv = Shutdown_hash(&o_conv);
45660         return ret_conv;
45661 }
45662
45663 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
45664         LDKShutdown a_conv;
45665         a_conv.inner = untag_ptr(a);
45666         a_conv.is_owned = ptr_is_owned(a);
45667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45668         a_conv.is_owned = false;
45669         LDKShutdown b_conv;
45670         b_conv.inner = untag_ptr(b);
45671         b_conv.is_owned = ptr_is_owned(b);
45672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45673         b_conv.is_owned = false;
45674         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
45675         return ret_conv;
45676 }
45677
45678 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
45679         LDKClosingSignedFeeRange this_obj_conv;
45680         this_obj_conv.inner = untag_ptr(this_obj);
45681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45683         ClosingSignedFeeRange_free(this_obj_conv);
45684 }
45685
45686 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
45687         LDKClosingSignedFeeRange this_ptr_conv;
45688         this_ptr_conv.inner = untag_ptr(this_ptr);
45689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45691         this_ptr_conv.is_owned = false;
45692         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
45693         return ret_conv;
45694 }
45695
45696 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
45697         LDKClosingSignedFeeRange this_ptr_conv;
45698         this_ptr_conv.inner = untag_ptr(this_ptr);
45699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45701         this_ptr_conv.is_owned = false;
45702         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
45703 }
45704
45705 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
45706         LDKClosingSignedFeeRange this_ptr_conv;
45707         this_ptr_conv.inner = untag_ptr(this_ptr);
45708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45710         this_ptr_conv.is_owned = false;
45711         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
45712         return ret_conv;
45713 }
45714
45715 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
45716         LDKClosingSignedFeeRange this_ptr_conv;
45717         this_ptr_conv.inner = untag_ptr(this_ptr);
45718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45720         this_ptr_conv.is_owned = false;
45721         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
45722 }
45723
45724 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
45725         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
45726         uint64_t ret_ref = 0;
45727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45729         return ret_ref;
45730 }
45731
45732 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
45733         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
45734         uint64_t ret_ref = 0;
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45737         return ret_ref;
45738 }
45739 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
45740         LDKClosingSignedFeeRange arg_conv;
45741         arg_conv.inner = untag_ptr(arg);
45742         arg_conv.is_owned = ptr_is_owned(arg);
45743         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45744         arg_conv.is_owned = false;
45745         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
45746         return ret_conv;
45747 }
45748
45749 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
45750         LDKClosingSignedFeeRange orig_conv;
45751         orig_conv.inner = untag_ptr(orig);
45752         orig_conv.is_owned = ptr_is_owned(orig);
45753         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45754         orig_conv.is_owned = false;
45755         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
45756         uint64_t ret_ref = 0;
45757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45759         return ret_ref;
45760 }
45761
45762 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_hash"))) TS_ClosingSignedFeeRange_hash(uint64_t o) {
45763         LDKClosingSignedFeeRange o_conv;
45764         o_conv.inner = untag_ptr(o);
45765         o_conv.is_owned = ptr_is_owned(o);
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45767         o_conv.is_owned = false;
45768         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
45769         return ret_conv;
45770 }
45771
45772 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
45773         LDKClosingSignedFeeRange a_conv;
45774         a_conv.inner = untag_ptr(a);
45775         a_conv.is_owned = ptr_is_owned(a);
45776         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45777         a_conv.is_owned = false;
45778         LDKClosingSignedFeeRange b_conv;
45779         b_conv.inner = untag_ptr(b);
45780         b_conv.is_owned = ptr_is_owned(b);
45781         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45782         b_conv.is_owned = false;
45783         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
45784         return ret_conv;
45785 }
45786
45787 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
45788         LDKClosingSigned this_obj_conv;
45789         this_obj_conv.inner = untag_ptr(this_obj);
45790         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45792         ClosingSigned_free(this_obj_conv);
45793 }
45794
45795 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
45796         LDKClosingSigned this_ptr_conv;
45797         this_ptr_conv.inner = untag_ptr(this_ptr);
45798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45800         this_ptr_conv.is_owned = false;
45801         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45802         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
45803         return ret_arr;
45804 }
45805
45806 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45807         LDKClosingSigned this_ptr_conv;
45808         this_ptr_conv.inner = untag_ptr(this_ptr);
45809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45811         this_ptr_conv.is_owned = false;
45812         LDKThirtyTwoBytes val_ref;
45813         CHECK(val->arr_len == 32);
45814         memcpy(val_ref.data, val->elems, 32); FREE(val);
45815         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
45816 }
45817
45818 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
45819         LDKClosingSigned this_ptr_conv;
45820         this_ptr_conv.inner = untag_ptr(this_ptr);
45821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45823         this_ptr_conv.is_owned = false;
45824         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
45825         return ret_conv;
45826 }
45827
45828 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
45829         LDKClosingSigned this_ptr_conv;
45830         this_ptr_conv.inner = untag_ptr(this_ptr);
45831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45833         this_ptr_conv.is_owned = false;
45834         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
45835 }
45836
45837 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
45838         LDKClosingSigned this_ptr_conv;
45839         this_ptr_conv.inner = untag_ptr(this_ptr);
45840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45842         this_ptr_conv.is_owned = false;
45843         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
45844         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
45845         return ret_arr;
45846 }
45847
45848 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
45849         LDKClosingSigned this_ptr_conv;
45850         this_ptr_conv.inner = untag_ptr(this_ptr);
45851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45853         this_ptr_conv.is_owned = false;
45854         LDKECDSASignature val_ref;
45855         CHECK(val->arr_len == 64);
45856         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
45857         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
45858 }
45859
45860 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
45861         LDKClosingSigned this_ptr_conv;
45862         this_ptr_conv.inner = untag_ptr(this_ptr);
45863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45865         this_ptr_conv.is_owned = false;
45866         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
45867         uint64_t ret_ref = 0;
45868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45870         return ret_ref;
45871 }
45872
45873 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
45874         LDKClosingSigned this_ptr_conv;
45875         this_ptr_conv.inner = untag_ptr(this_ptr);
45876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45878         this_ptr_conv.is_owned = false;
45879         LDKClosingSignedFeeRange val_conv;
45880         val_conv.inner = untag_ptr(val);
45881         val_conv.is_owned = ptr_is_owned(val);
45882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45883         val_conv = ClosingSignedFeeRange_clone(&val_conv);
45884         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
45885 }
45886
45887 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) {
45888         LDKThirtyTwoBytes channel_id_arg_ref;
45889         CHECK(channel_id_arg->arr_len == 32);
45890         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45891         LDKECDSASignature signature_arg_ref;
45892         CHECK(signature_arg->arr_len == 64);
45893         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
45894         LDKClosingSignedFeeRange fee_range_arg_conv;
45895         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
45896         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
45897         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
45898         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
45899         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
45900         uint64_t ret_ref = 0;
45901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45903         return ret_ref;
45904 }
45905
45906 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
45907         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
45908         uint64_t ret_ref = 0;
45909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45911         return ret_ref;
45912 }
45913 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
45914         LDKClosingSigned arg_conv;
45915         arg_conv.inner = untag_ptr(arg);
45916         arg_conv.is_owned = ptr_is_owned(arg);
45917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45918         arg_conv.is_owned = false;
45919         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
45920         return ret_conv;
45921 }
45922
45923 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
45924         LDKClosingSigned orig_conv;
45925         orig_conv.inner = untag_ptr(orig);
45926         orig_conv.is_owned = ptr_is_owned(orig);
45927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45928         orig_conv.is_owned = false;
45929         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
45930         uint64_t ret_ref = 0;
45931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45933         return ret_ref;
45934 }
45935
45936 int64_t  __attribute__((export_name("TS_ClosingSigned_hash"))) TS_ClosingSigned_hash(uint64_t o) {
45937         LDKClosingSigned o_conv;
45938         o_conv.inner = untag_ptr(o);
45939         o_conv.is_owned = ptr_is_owned(o);
45940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45941         o_conv.is_owned = false;
45942         int64_t ret_conv = ClosingSigned_hash(&o_conv);
45943         return ret_conv;
45944 }
45945
45946 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
45947         LDKClosingSigned a_conv;
45948         a_conv.inner = untag_ptr(a);
45949         a_conv.is_owned = ptr_is_owned(a);
45950         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45951         a_conv.is_owned = false;
45952         LDKClosingSigned b_conv;
45953         b_conv.inner = untag_ptr(b);
45954         b_conv.is_owned = ptr_is_owned(b);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45956         b_conv.is_owned = false;
45957         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
45958         return ret_conv;
45959 }
45960
45961 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
45962         LDKUpdateAddHTLC this_obj_conv;
45963         this_obj_conv.inner = untag_ptr(this_obj);
45964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45966         UpdateAddHTLC_free(this_obj_conv);
45967 }
45968
45969 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
45970         LDKUpdateAddHTLC this_ptr_conv;
45971         this_ptr_conv.inner = untag_ptr(this_ptr);
45972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45974         this_ptr_conv.is_owned = false;
45975         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45976         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
45977         return ret_arr;
45978 }
45979
45980 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45981         LDKUpdateAddHTLC this_ptr_conv;
45982         this_ptr_conv.inner = untag_ptr(this_ptr);
45983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45985         this_ptr_conv.is_owned = false;
45986         LDKThirtyTwoBytes val_ref;
45987         CHECK(val->arr_len == 32);
45988         memcpy(val_ref.data, val->elems, 32); FREE(val);
45989         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
45990 }
45991
45992 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
45993         LDKUpdateAddHTLC this_ptr_conv;
45994         this_ptr_conv.inner = untag_ptr(this_ptr);
45995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45997         this_ptr_conv.is_owned = false;
45998         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
45999         return ret_conv;
46000 }
46001
46002 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46003         LDKUpdateAddHTLC this_ptr_conv;
46004         this_ptr_conv.inner = untag_ptr(this_ptr);
46005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46007         this_ptr_conv.is_owned = false;
46008         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46009 }
46010
46011 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
46012         LDKUpdateAddHTLC this_ptr_conv;
46013         this_ptr_conv.inner = untag_ptr(this_ptr);
46014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46016         this_ptr_conv.is_owned = false;
46017         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46018         return ret_conv;
46019 }
46020
46021 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
46022         LDKUpdateAddHTLC this_ptr_conv;
46023         this_ptr_conv.inner = untag_ptr(this_ptr);
46024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46026         this_ptr_conv.is_owned = false;
46027         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46028 }
46029
46030 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
46031         LDKUpdateAddHTLC this_ptr_conv;
46032         this_ptr_conv.inner = untag_ptr(this_ptr);
46033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46035         this_ptr_conv.is_owned = false;
46036         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46037         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
46038         return ret_arr;
46039 }
46040
46041 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
46042         LDKUpdateAddHTLC this_ptr_conv;
46043         this_ptr_conv.inner = untag_ptr(this_ptr);
46044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46046         this_ptr_conv.is_owned = false;
46047         LDKThirtyTwoBytes val_ref;
46048         CHECK(val->arr_len == 32);
46049         memcpy(val_ref.data, val->elems, 32); FREE(val);
46050         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46051 }
46052
46053 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
46054         LDKUpdateAddHTLC this_ptr_conv;
46055         this_ptr_conv.inner = untag_ptr(this_ptr);
46056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46058         this_ptr_conv.is_owned = false;
46059         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46060         return ret_conv;
46061 }
46062
46063 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
46064         LDKUpdateAddHTLC this_ptr_conv;
46065         this_ptr_conv.inner = untag_ptr(this_ptr);
46066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46068         this_ptr_conv.is_owned = false;
46069         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46070 }
46071
46072 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
46073         LDKUpdateAddHTLC this_ptr_conv;
46074         this_ptr_conv.inner = untag_ptr(this_ptr);
46075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46077         this_ptr_conv.is_owned = false;
46078         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46079         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46080         uint64_t ret_ref = tag_ptr(ret_copy, true);
46081         return ret_ref;
46082 }
46083
46084 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
46085         LDKUpdateAddHTLC this_ptr_conv;
46086         this_ptr_conv.inner = untag_ptr(this_ptr);
46087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46089         this_ptr_conv.is_owned = false;
46090         void* val_ptr = untag_ptr(val);
46091         CHECK_ACCESS(val_ptr);
46092         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46093         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46094         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46095 }
46096
46097 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_onion_routing_packet"))) TS_UpdateAddHTLC_get_onion_routing_packet(uint64_t this_ptr) {
46098         LDKUpdateAddHTLC this_ptr_conv;
46099         this_ptr_conv.inner = untag_ptr(this_ptr);
46100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46102         this_ptr_conv.is_owned = false;
46103         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
46104         uint64_t ret_ref = 0;
46105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46107         return ret_ref;
46108 }
46109
46110 void  __attribute__((export_name("TS_UpdateAddHTLC_set_onion_routing_packet"))) TS_UpdateAddHTLC_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
46111         LDKUpdateAddHTLC this_ptr_conv;
46112         this_ptr_conv.inner = untag_ptr(this_ptr);
46113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46115         this_ptr_conv.is_owned = false;
46116         LDKOnionPacket val_conv;
46117         val_conv.inner = untag_ptr(val);
46118         val_conv.is_owned = ptr_is_owned(val);
46119         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46120         val_conv = OnionPacket_clone(&val_conv);
46121         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
46122 }
46123
46124 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_blinding_point"))) TS_UpdateAddHTLC_get_blinding_point(uint64_t this_ptr) {
46125         LDKUpdateAddHTLC this_ptr_conv;
46126         this_ptr_conv.inner = untag_ptr(this_ptr);
46127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46129         this_ptr_conv.is_owned = false;
46130         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46131         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46132         return ret_arr;
46133 }
46134
46135 void  __attribute__((export_name("TS_UpdateAddHTLC_set_blinding_point"))) TS_UpdateAddHTLC_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46136         LDKUpdateAddHTLC this_ptr_conv;
46137         this_ptr_conv.inner = untag_ptr(this_ptr);
46138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46140         this_ptr_conv.is_owned = false;
46141         LDKPublicKey val_ref;
46142         CHECK(val->arr_len == 33);
46143         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46144         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
46145 }
46146
46147 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_new"))) TS_UpdateAddHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, uint64_t skimmed_fee_msat_arg, uint64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
46148         LDKThirtyTwoBytes channel_id_arg_ref;
46149         CHECK(channel_id_arg->arr_len == 32);
46150         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46151         LDKThirtyTwoBytes payment_hash_arg_ref;
46152         CHECK(payment_hash_arg->arr_len == 32);
46153         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
46154         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46155         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46156         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46157         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46158         LDKOnionPacket onion_routing_packet_arg_conv;
46159         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46160         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46161         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46162         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
46163         LDKPublicKey blinding_point_arg_ref;
46164         CHECK(blinding_point_arg->arr_len == 33);
46165         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46166         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_ref, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
46167         uint64_t ret_ref = 0;
46168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46170         return ret_ref;
46171 }
46172
46173 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46174         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46175         uint64_t ret_ref = 0;
46176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46178         return ret_ref;
46179 }
46180 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
46181         LDKUpdateAddHTLC arg_conv;
46182         arg_conv.inner = untag_ptr(arg);
46183         arg_conv.is_owned = ptr_is_owned(arg);
46184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46185         arg_conv.is_owned = false;
46186         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
46187         return ret_conv;
46188 }
46189
46190 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
46191         LDKUpdateAddHTLC orig_conv;
46192         orig_conv.inner = untag_ptr(orig);
46193         orig_conv.is_owned = ptr_is_owned(orig);
46194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46195         orig_conv.is_owned = false;
46196         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
46197         uint64_t ret_ref = 0;
46198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46200         return ret_ref;
46201 }
46202
46203 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_hash"))) TS_UpdateAddHTLC_hash(uint64_t o) {
46204         LDKUpdateAddHTLC o_conv;
46205         o_conv.inner = untag_ptr(o);
46206         o_conv.is_owned = ptr_is_owned(o);
46207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46208         o_conv.is_owned = false;
46209         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
46210         return ret_conv;
46211 }
46212
46213 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
46214         LDKUpdateAddHTLC a_conv;
46215         a_conv.inner = untag_ptr(a);
46216         a_conv.is_owned = ptr_is_owned(a);
46217         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46218         a_conv.is_owned = false;
46219         LDKUpdateAddHTLC b_conv;
46220         b_conv.inner = untag_ptr(b);
46221         b_conv.is_owned = ptr_is_owned(b);
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46223         b_conv.is_owned = false;
46224         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
46225         return ret_conv;
46226 }
46227
46228 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
46229         LDKOnionMessage this_obj_conv;
46230         this_obj_conv.inner = untag_ptr(this_obj);
46231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46233         OnionMessage_free(this_obj_conv);
46234 }
46235
46236 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
46237         LDKOnionMessage this_ptr_conv;
46238         this_ptr_conv.inner = untag_ptr(this_ptr);
46239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46241         this_ptr_conv.is_owned = false;
46242         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46243         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46244         return ret_arr;
46245 }
46246
46247 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46248         LDKOnionMessage this_ptr_conv;
46249         this_ptr_conv.inner = untag_ptr(this_ptr);
46250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46252         this_ptr_conv.is_owned = false;
46253         LDKPublicKey val_ref;
46254         CHECK(val->arr_len == 33);
46255         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46256         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
46257 }
46258
46259 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
46260         LDKOnionMessage this_ptr_conv;
46261         this_ptr_conv.inner = untag_ptr(this_ptr);
46262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46264         this_ptr_conv.is_owned = false;
46265         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
46266         uint64_t ret_ref = 0;
46267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46269         return ret_ref;
46270 }
46271
46272 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
46273         LDKOnionMessage this_ptr_conv;
46274         this_ptr_conv.inner = untag_ptr(this_ptr);
46275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46277         this_ptr_conv.is_owned = false;
46278         LDKPacket val_conv;
46279         val_conv.inner = untag_ptr(val);
46280         val_conv.is_owned = ptr_is_owned(val);
46281         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46282         val_conv = Packet_clone(&val_conv);
46283         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
46284 }
46285
46286 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
46287         LDKPublicKey blinding_point_arg_ref;
46288         CHECK(blinding_point_arg->arr_len == 33);
46289         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46290         LDKPacket onion_routing_packet_arg_conv;
46291         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46292         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46293         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46294         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
46295         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
46296         uint64_t ret_ref = 0;
46297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46299         return ret_ref;
46300 }
46301
46302 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
46303         LDKOnionMessage ret_var = OnionMessage_clone(arg);
46304         uint64_t ret_ref = 0;
46305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46307         return ret_ref;
46308 }
46309 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
46310         LDKOnionMessage arg_conv;
46311         arg_conv.inner = untag_ptr(arg);
46312         arg_conv.is_owned = ptr_is_owned(arg);
46313         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46314         arg_conv.is_owned = false;
46315         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
46316         return ret_conv;
46317 }
46318
46319 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
46320         LDKOnionMessage orig_conv;
46321         orig_conv.inner = untag_ptr(orig);
46322         orig_conv.is_owned = ptr_is_owned(orig);
46323         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46324         orig_conv.is_owned = false;
46325         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
46326         uint64_t ret_ref = 0;
46327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46329         return ret_ref;
46330 }
46331
46332 int64_t  __attribute__((export_name("TS_OnionMessage_hash"))) TS_OnionMessage_hash(uint64_t o) {
46333         LDKOnionMessage o_conv;
46334         o_conv.inner = untag_ptr(o);
46335         o_conv.is_owned = ptr_is_owned(o);
46336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46337         o_conv.is_owned = false;
46338         int64_t ret_conv = OnionMessage_hash(&o_conv);
46339         return ret_conv;
46340 }
46341
46342 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
46343         LDKOnionMessage a_conv;
46344         a_conv.inner = untag_ptr(a);
46345         a_conv.is_owned = ptr_is_owned(a);
46346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46347         a_conv.is_owned = false;
46348         LDKOnionMessage b_conv;
46349         b_conv.inner = untag_ptr(b);
46350         b_conv.is_owned = ptr_is_owned(b);
46351         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46352         b_conv.is_owned = false;
46353         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
46354         return ret_conv;
46355 }
46356
46357 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
46358         LDKUpdateFulfillHTLC this_obj_conv;
46359         this_obj_conv.inner = untag_ptr(this_obj);
46360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46362         UpdateFulfillHTLC_free(this_obj_conv);
46363 }
46364
46365 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
46366         LDKUpdateFulfillHTLC this_ptr_conv;
46367         this_ptr_conv.inner = untag_ptr(this_ptr);
46368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46370         this_ptr_conv.is_owned = false;
46371         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46372         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
46373         return ret_arr;
46374 }
46375
46376 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46377         LDKUpdateFulfillHTLC this_ptr_conv;
46378         this_ptr_conv.inner = untag_ptr(this_ptr);
46379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46381         this_ptr_conv.is_owned = false;
46382         LDKThirtyTwoBytes val_ref;
46383         CHECK(val->arr_len == 32);
46384         memcpy(val_ref.data, val->elems, 32); FREE(val);
46385         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
46386 }
46387
46388 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
46389         LDKUpdateFulfillHTLC this_ptr_conv;
46390         this_ptr_conv.inner = untag_ptr(this_ptr);
46391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46393         this_ptr_conv.is_owned = false;
46394         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
46395         return ret_conv;
46396 }
46397
46398 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46399         LDKUpdateFulfillHTLC this_ptr_conv;
46400         this_ptr_conv.inner = untag_ptr(this_ptr);
46401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46403         this_ptr_conv.is_owned = false;
46404         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
46405 }
46406
46407 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
46408         LDKUpdateFulfillHTLC this_ptr_conv;
46409         this_ptr_conv.inner = untag_ptr(this_ptr);
46410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46412         this_ptr_conv.is_owned = false;
46413         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46414         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
46415         return ret_arr;
46416 }
46417
46418 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
46419         LDKUpdateFulfillHTLC this_ptr_conv;
46420         this_ptr_conv.inner = untag_ptr(this_ptr);
46421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46423         this_ptr_conv.is_owned = false;
46424         LDKThirtyTwoBytes val_ref;
46425         CHECK(val->arr_len == 32);
46426         memcpy(val_ref.data, val->elems, 32); FREE(val);
46427         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
46428 }
46429
46430 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) {
46431         LDKThirtyTwoBytes channel_id_arg_ref;
46432         CHECK(channel_id_arg->arr_len == 32);
46433         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46434         LDKThirtyTwoBytes payment_preimage_arg_ref;
46435         CHECK(payment_preimage_arg->arr_len == 32);
46436         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
46437         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
46438         uint64_t ret_ref = 0;
46439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46441         return ret_ref;
46442 }
46443
46444 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
46445         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
46446         uint64_t ret_ref = 0;
46447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46449         return ret_ref;
46450 }
46451 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
46452         LDKUpdateFulfillHTLC arg_conv;
46453         arg_conv.inner = untag_ptr(arg);
46454         arg_conv.is_owned = ptr_is_owned(arg);
46455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46456         arg_conv.is_owned = false;
46457         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
46458         return ret_conv;
46459 }
46460
46461 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
46462         LDKUpdateFulfillHTLC orig_conv;
46463         orig_conv.inner = untag_ptr(orig);
46464         orig_conv.is_owned = ptr_is_owned(orig);
46465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46466         orig_conv.is_owned = false;
46467         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
46468         uint64_t ret_ref = 0;
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46471         return ret_ref;
46472 }
46473
46474 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_hash"))) TS_UpdateFulfillHTLC_hash(uint64_t o) {
46475         LDKUpdateFulfillHTLC o_conv;
46476         o_conv.inner = untag_ptr(o);
46477         o_conv.is_owned = ptr_is_owned(o);
46478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46479         o_conv.is_owned = false;
46480         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
46481         return ret_conv;
46482 }
46483
46484 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
46485         LDKUpdateFulfillHTLC a_conv;
46486         a_conv.inner = untag_ptr(a);
46487         a_conv.is_owned = ptr_is_owned(a);
46488         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46489         a_conv.is_owned = false;
46490         LDKUpdateFulfillHTLC b_conv;
46491         b_conv.inner = untag_ptr(b);
46492         b_conv.is_owned = ptr_is_owned(b);
46493         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46494         b_conv.is_owned = false;
46495         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
46496         return ret_conv;
46497 }
46498
46499 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
46500         LDKUpdateFailHTLC this_obj_conv;
46501         this_obj_conv.inner = untag_ptr(this_obj);
46502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46504         UpdateFailHTLC_free(this_obj_conv);
46505 }
46506
46507 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
46508         LDKUpdateFailHTLC this_ptr_conv;
46509         this_ptr_conv.inner = untag_ptr(this_ptr);
46510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46512         this_ptr_conv.is_owned = false;
46513         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46514         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
46515         return ret_arr;
46516 }
46517
46518 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46519         LDKUpdateFailHTLC this_ptr_conv;
46520         this_ptr_conv.inner = untag_ptr(this_ptr);
46521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46523         this_ptr_conv.is_owned = false;
46524         LDKThirtyTwoBytes val_ref;
46525         CHECK(val->arr_len == 32);
46526         memcpy(val_ref.data, val->elems, 32); FREE(val);
46527         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
46528 }
46529
46530 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
46531         LDKUpdateFailHTLC this_ptr_conv;
46532         this_ptr_conv.inner = untag_ptr(this_ptr);
46533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46535         this_ptr_conv.is_owned = false;
46536         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
46537         return ret_conv;
46538 }
46539
46540 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46541         LDKUpdateFailHTLC this_ptr_conv;
46542         this_ptr_conv.inner = untag_ptr(this_ptr);
46543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46545         this_ptr_conv.is_owned = false;
46546         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
46547 }
46548
46549 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
46550         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
46551         uint64_t ret_ref = 0;
46552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46554         return ret_ref;
46555 }
46556 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
46557         LDKUpdateFailHTLC arg_conv;
46558         arg_conv.inner = untag_ptr(arg);
46559         arg_conv.is_owned = ptr_is_owned(arg);
46560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46561         arg_conv.is_owned = false;
46562         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
46563         return ret_conv;
46564 }
46565
46566 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
46567         LDKUpdateFailHTLC orig_conv;
46568         orig_conv.inner = untag_ptr(orig);
46569         orig_conv.is_owned = ptr_is_owned(orig);
46570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46571         orig_conv.is_owned = false;
46572         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
46573         uint64_t ret_ref = 0;
46574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46576         return ret_ref;
46577 }
46578
46579 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_hash"))) TS_UpdateFailHTLC_hash(uint64_t o) {
46580         LDKUpdateFailHTLC o_conv;
46581         o_conv.inner = untag_ptr(o);
46582         o_conv.is_owned = ptr_is_owned(o);
46583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46584         o_conv.is_owned = false;
46585         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
46586         return ret_conv;
46587 }
46588
46589 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
46590         LDKUpdateFailHTLC a_conv;
46591         a_conv.inner = untag_ptr(a);
46592         a_conv.is_owned = ptr_is_owned(a);
46593         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46594         a_conv.is_owned = false;
46595         LDKUpdateFailHTLC b_conv;
46596         b_conv.inner = untag_ptr(b);
46597         b_conv.is_owned = ptr_is_owned(b);
46598         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46599         b_conv.is_owned = false;
46600         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
46601         return ret_conv;
46602 }
46603
46604 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
46605         LDKUpdateFailMalformedHTLC this_obj_conv;
46606         this_obj_conv.inner = untag_ptr(this_obj);
46607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46609         UpdateFailMalformedHTLC_free(this_obj_conv);
46610 }
46611
46612 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
46613         LDKUpdateFailMalformedHTLC this_ptr_conv;
46614         this_ptr_conv.inner = untag_ptr(this_ptr);
46615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46617         this_ptr_conv.is_owned = false;
46618         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46619         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
46620         return ret_arr;
46621 }
46622
46623 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46624         LDKUpdateFailMalformedHTLC this_ptr_conv;
46625         this_ptr_conv.inner = untag_ptr(this_ptr);
46626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46628         this_ptr_conv.is_owned = false;
46629         LDKThirtyTwoBytes val_ref;
46630         CHECK(val->arr_len == 32);
46631         memcpy(val_ref.data, val->elems, 32); FREE(val);
46632         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
46633 }
46634
46635 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
46636         LDKUpdateFailMalformedHTLC this_ptr_conv;
46637         this_ptr_conv.inner = untag_ptr(this_ptr);
46638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46640         this_ptr_conv.is_owned = false;
46641         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
46642         return ret_conv;
46643 }
46644
46645 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46646         LDKUpdateFailMalformedHTLC this_ptr_conv;
46647         this_ptr_conv.inner = untag_ptr(this_ptr);
46648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46650         this_ptr_conv.is_owned = false;
46651         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
46652 }
46653
46654 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
46655         LDKUpdateFailMalformedHTLC this_ptr_conv;
46656         this_ptr_conv.inner = untag_ptr(this_ptr);
46657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46659         this_ptr_conv.is_owned = false;
46660         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
46661         return ret_conv;
46662 }
46663
46664 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
46665         LDKUpdateFailMalformedHTLC this_ptr_conv;
46666         this_ptr_conv.inner = untag_ptr(this_ptr);
46667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46669         this_ptr_conv.is_owned = false;
46670         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
46671 }
46672
46673 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
46674         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
46675         uint64_t ret_ref = 0;
46676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46678         return ret_ref;
46679 }
46680 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
46681         LDKUpdateFailMalformedHTLC arg_conv;
46682         arg_conv.inner = untag_ptr(arg);
46683         arg_conv.is_owned = ptr_is_owned(arg);
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46685         arg_conv.is_owned = false;
46686         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
46687         return ret_conv;
46688 }
46689
46690 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
46691         LDKUpdateFailMalformedHTLC orig_conv;
46692         orig_conv.inner = untag_ptr(orig);
46693         orig_conv.is_owned = ptr_is_owned(orig);
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46695         orig_conv.is_owned = false;
46696         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
46697         uint64_t ret_ref = 0;
46698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46700         return ret_ref;
46701 }
46702
46703 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_hash"))) TS_UpdateFailMalformedHTLC_hash(uint64_t o) {
46704         LDKUpdateFailMalformedHTLC o_conv;
46705         o_conv.inner = untag_ptr(o);
46706         o_conv.is_owned = ptr_is_owned(o);
46707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46708         o_conv.is_owned = false;
46709         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
46710         return ret_conv;
46711 }
46712
46713 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
46714         LDKUpdateFailMalformedHTLC a_conv;
46715         a_conv.inner = untag_ptr(a);
46716         a_conv.is_owned = ptr_is_owned(a);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46718         a_conv.is_owned = false;
46719         LDKUpdateFailMalformedHTLC b_conv;
46720         b_conv.inner = untag_ptr(b);
46721         b_conv.is_owned = ptr_is_owned(b);
46722         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46723         b_conv.is_owned = false;
46724         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
46725         return ret_conv;
46726 }
46727
46728 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
46729         LDKCommitmentSigned this_obj_conv;
46730         this_obj_conv.inner = untag_ptr(this_obj);
46731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46733         CommitmentSigned_free(this_obj_conv);
46734 }
46735
46736 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
46737         LDKCommitmentSigned this_ptr_conv;
46738         this_ptr_conv.inner = untag_ptr(this_ptr);
46739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46741         this_ptr_conv.is_owned = false;
46742         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46743         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
46744         return ret_arr;
46745 }
46746
46747 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46748         LDKCommitmentSigned this_ptr_conv;
46749         this_ptr_conv.inner = untag_ptr(this_ptr);
46750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46752         this_ptr_conv.is_owned = false;
46753         LDKThirtyTwoBytes val_ref;
46754         CHECK(val->arr_len == 32);
46755         memcpy(val_ref.data, val->elems, 32); FREE(val);
46756         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
46757 }
46758
46759 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
46760         LDKCommitmentSigned this_ptr_conv;
46761         this_ptr_conv.inner = untag_ptr(this_ptr);
46762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46764         this_ptr_conv.is_owned = false;
46765         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46766         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
46767         return ret_arr;
46768 }
46769
46770 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
46771         LDKCommitmentSigned this_ptr_conv;
46772         this_ptr_conv.inner = untag_ptr(this_ptr);
46773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46775         this_ptr_conv.is_owned = false;
46776         LDKECDSASignature val_ref;
46777         CHECK(val->arr_len == 64);
46778         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46779         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
46780 }
46781
46782 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
46783         LDKCommitmentSigned this_ptr_conv;
46784         this_ptr_conv.inner = untag_ptr(this_ptr);
46785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46787         this_ptr_conv.is_owned = false;
46788         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
46789         ptrArray ret_arr = NULL;
46790         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
46791         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
46792         for (size_t m = 0; m < ret_var.datalen; m++) {
46793                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
46794                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
46795                 ret_arr_ptr[m] = ret_conv_12_arr;
46796         }
46797         
46798         FREE(ret_var.data);
46799         return ret_arr;
46800 }
46801
46802 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
46803         LDKCommitmentSigned this_ptr_conv;
46804         this_ptr_conv.inner = untag_ptr(this_ptr);
46805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46807         this_ptr_conv.is_owned = false;
46808         LDKCVec_ECDSASignatureZ val_constr;
46809         val_constr.datalen = val->arr_len;
46810         if (val_constr.datalen > 0)
46811                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46812         else
46813                 val_constr.data = NULL;
46814         int8_tArray* val_vals = (void*) val->elems;
46815         for (size_t m = 0; m < val_constr.datalen; m++) {
46816                 int8_tArray val_conv_12 = val_vals[m];
46817                 LDKECDSASignature val_conv_12_ref;
46818                 CHECK(val_conv_12->arr_len == 64);
46819                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
46820                 val_constr.data[m] = val_conv_12_ref;
46821         }
46822         FREE(val);
46823         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
46824 }
46825
46826 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
46827         LDKThirtyTwoBytes channel_id_arg_ref;
46828         CHECK(channel_id_arg->arr_len == 32);
46829         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46830         LDKECDSASignature signature_arg_ref;
46831         CHECK(signature_arg->arr_len == 64);
46832         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
46833         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
46834         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
46835         if (htlc_signatures_arg_constr.datalen > 0)
46836                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46837         else
46838                 htlc_signatures_arg_constr.data = NULL;
46839         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
46840         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
46841                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
46842                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
46843                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
46844                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
46845                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
46846         }
46847         FREE(htlc_signatures_arg);
46848         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
46849         uint64_t ret_ref = 0;
46850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46852         return ret_ref;
46853 }
46854
46855 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
46856         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
46857         uint64_t ret_ref = 0;
46858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46860         return ret_ref;
46861 }
46862 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
46863         LDKCommitmentSigned arg_conv;
46864         arg_conv.inner = untag_ptr(arg);
46865         arg_conv.is_owned = ptr_is_owned(arg);
46866         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46867         arg_conv.is_owned = false;
46868         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
46869         return ret_conv;
46870 }
46871
46872 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
46873         LDKCommitmentSigned orig_conv;
46874         orig_conv.inner = untag_ptr(orig);
46875         orig_conv.is_owned = ptr_is_owned(orig);
46876         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46877         orig_conv.is_owned = false;
46878         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
46879         uint64_t ret_ref = 0;
46880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46882         return ret_ref;
46883 }
46884
46885 int64_t  __attribute__((export_name("TS_CommitmentSigned_hash"))) TS_CommitmentSigned_hash(uint64_t o) {
46886         LDKCommitmentSigned o_conv;
46887         o_conv.inner = untag_ptr(o);
46888         o_conv.is_owned = ptr_is_owned(o);
46889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46890         o_conv.is_owned = false;
46891         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
46892         return ret_conv;
46893 }
46894
46895 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
46896         LDKCommitmentSigned a_conv;
46897         a_conv.inner = untag_ptr(a);
46898         a_conv.is_owned = ptr_is_owned(a);
46899         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46900         a_conv.is_owned = false;
46901         LDKCommitmentSigned b_conv;
46902         b_conv.inner = untag_ptr(b);
46903         b_conv.is_owned = ptr_is_owned(b);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46905         b_conv.is_owned = false;
46906         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
46907         return ret_conv;
46908 }
46909
46910 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
46911         LDKRevokeAndACK this_obj_conv;
46912         this_obj_conv.inner = untag_ptr(this_obj);
46913         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46915         RevokeAndACK_free(this_obj_conv);
46916 }
46917
46918 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
46919         LDKRevokeAndACK this_ptr_conv;
46920         this_ptr_conv.inner = untag_ptr(this_ptr);
46921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46923         this_ptr_conv.is_owned = false;
46924         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46925         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
46926         return ret_arr;
46927 }
46928
46929 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46930         LDKRevokeAndACK this_ptr_conv;
46931         this_ptr_conv.inner = untag_ptr(this_ptr);
46932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46934         this_ptr_conv.is_owned = false;
46935         LDKThirtyTwoBytes val_ref;
46936         CHECK(val->arr_len == 32);
46937         memcpy(val_ref.data, val->elems, 32); FREE(val);
46938         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
46939 }
46940
46941 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
46942         LDKRevokeAndACK this_ptr_conv;
46943         this_ptr_conv.inner = untag_ptr(this_ptr);
46944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46946         this_ptr_conv.is_owned = false;
46947         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46948         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
46949         return ret_arr;
46950 }
46951
46952 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
46953         LDKRevokeAndACK this_ptr_conv;
46954         this_ptr_conv.inner = untag_ptr(this_ptr);
46955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46957         this_ptr_conv.is_owned = false;
46958         LDKThirtyTwoBytes val_ref;
46959         CHECK(val->arr_len == 32);
46960         memcpy(val_ref.data, val->elems, 32); FREE(val);
46961         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
46962 }
46963
46964 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
46965         LDKRevokeAndACK this_ptr_conv;
46966         this_ptr_conv.inner = untag_ptr(this_ptr);
46967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46969         this_ptr_conv.is_owned = false;
46970         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46971         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46972         return ret_arr;
46973 }
46974
46975 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) {
46976         LDKRevokeAndACK this_ptr_conv;
46977         this_ptr_conv.inner = untag_ptr(this_ptr);
46978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46980         this_ptr_conv.is_owned = false;
46981         LDKPublicKey val_ref;
46982         CHECK(val->arr_len == 33);
46983         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46984         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
46985 }
46986
46987 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) {
46988         LDKThirtyTwoBytes channel_id_arg_ref;
46989         CHECK(channel_id_arg->arr_len == 32);
46990         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46991         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
46992         CHECK(per_commitment_secret_arg->arr_len == 32);
46993         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
46994         LDKPublicKey next_per_commitment_point_arg_ref;
46995         CHECK(next_per_commitment_point_arg->arr_len == 33);
46996         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
46997         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
46998         uint64_t ret_ref = 0;
46999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47001         return ret_ref;
47002 }
47003
47004 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47005         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47006         uint64_t ret_ref = 0;
47007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47009         return ret_ref;
47010 }
47011 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
47012         LDKRevokeAndACK arg_conv;
47013         arg_conv.inner = untag_ptr(arg);
47014         arg_conv.is_owned = ptr_is_owned(arg);
47015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47016         arg_conv.is_owned = false;
47017         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47018         return ret_conv;
47019 }
47020
47021 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
47022         LDKRevokeAndACK orig_conv;
47023         orig_conv.inner = untag_ptr(orig);
47024         orig_conv.is_owned = ptr_is_owned(orig);
47025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47026         orig_conv.is_owned = false;
47027         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47028         uint64_t ret_ref = 0;
47029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47031         return ret_ref;
47032 }
47033
47034 int64_t  __attribute__((export_name("TS_RevokeAndACK_hash"))) TS_RevokeAndACK_hash(uint64_t o) {
47035         LDKRevokeAndACK o_conv;
47036         o_conv.inner = untag_ptr(o);
47037         o_conv.is_owned = ptr_is_owned(o);
47038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47039         o_conv.is_owned = false;
47040         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
47041         return ret_conv;
47042 }
47043
47044 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
47045         LDKRevokeAndACK a_conv;
47046         a_conv.inner = untag_ptr(a);
47047         a_conv.is_owned = ptr_is_owned(a);
47048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47049         a_conv.is_owned = false;
47050         LDKRevokeAndACK b_conv;
47051         b_conv.inner = untag_ptr(b);
47052         b_conv.is_owned = ptr_is_owned(b);
47053         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47054         b_conv.is_owned = false;
47055         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47056         return ret_conv;
47057 }
47058
47059 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
47060         LDKUpdateFee this_obj_conv;
47061         this_obj_conv.inner = untag_ptr(this_obj);
47062         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47064         UpdateFee_free(this_obj_conv);
47065 }
47066
47067 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
47068         LDKUpdateFee this_ptr_conv;
47069         this_ptr_conv.inner = untag_ptr(this_ptr);
47070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47072         this_ptr_conv.is_owned = false;
47073         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47074         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
47075         return ret_arr;
47076 }
47077
47078 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
47079         LDKUpdateFee this_ptr_conv;
47080         this_ptr_conv.inner = untag_ptr(this_ptr);
47081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47083         this_ptr_conv.is_owned = false;
47084         LDKThirtyTwoBytes val_ref;
47085         CHECK(val->arr_len == 32);
47086         memcpy(val_ref.data, val->elems, 32); FREE(val);
47087         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47088 }
47089
47090 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
47091         LDKUpdateFee this_ptr_conv;
47092         this_ptr_conv.inner = untag_ptr(this_ptr);
47093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47095         this_ptr_conv.is_owned = false;
47096         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47097         return ret_conv;
47098 }
47099
47100 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
47101         LDKUpdateFee this_ptr_conv;
47102         this_ptr_conv.inner = untag_ptr(this_ptr);
47103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47105         this_ptr_conv.is_owned = false;
47106         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47107 }
47108
47109 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
47110         LDKThirtyTwoBytes channel_id_arg_ref;
47111         CHECK(channel_id_arg->arr_len == 32);
47112         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47113         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47114         uint64_t ret_ref = 0;
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47117         return ret_ref;
47118 }
47119
47120 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47121         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47122         uint64_t ret_ref = 0;
47123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47125         return ret_ref;
47126 }
47127 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
47128         LDKUpdateFee arg_conv;
47129         arg_conv.inner = untag_ptr(arg);
47130         arg_conv.is_owned = ptr_is_owned(arg);
47131         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47132         arg_conv.is_owned = false;
47133         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47134         return ret_conv;
47135 }
47136
47137 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
47138         LDKUpdateFee orig_conv;
47139         orig_conv.inner = untag_ptr(orig);
47140         orig_conv.is_owned = ptr_is_owned(orig);
47141         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47142         orig_conv.is_owned = false;
47143         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47144         uint64_t ret_ref = 0;
47145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47147         return ret_ref;
47148 }
47149
47150 int64_t  __attribute__((export_name("TS_UpdateFee_hash"))) TS_UpdateFee_hash(uint64_t o) {
47151         LDKUpdateFee o_conv;
47152         o_conv.inner = untag_ptr(o);
47153         o_conv.is_owned = ptr_is_owned(o);
47154         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47155         o_conv.is_owned = false;
47156         int64_t ret_conv = UpdateFee_hash(&o_conv);
47157         return ret_conv;
47158 }
47159
47160 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
47161         LDKUpdateFee a_conv;
47162         a_conv.inner = untag_ptr(a);
47163         a_conv.is_owned = ptr_is_owned(a);
47164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47165         a_conv.is_owned = false;
47166         LDKUpdateFee b_conv;
47167         b_conv.inner = untag_ptr(b);
47168         b_conv.is_owned = ptr_is_owned(b);
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47170         b_conv.is_owned = false;
47171         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47172         return ret_conv;
47173 }
47174
47175 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
47176         LDKChannelReestablish this_obj_conv;
47177         this_obj_conv.inner = untag_ptr(this_obj);
47178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47180         ChannelReestablish_free(this_obj_conv);
47181 }
47182
47183 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
47184         LDKChannelReestablish this_ptr_conv;
47185         this_ptr_conv.inner = untag_ptr(this_ptr);
47186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47188         this_ptr_conv.is_owned = false;
47189         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47190         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
47191         return ret_arr;
47192 }
47193
47194 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
47195         LDKChannelReestablish this_ptr_conv;
47196         this_ptr_conv.inner = untag_ptr(this_ptr);
47197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47199         this_ptr_conv.is_owned = false;
47200         LDKThirtyTwoBytes val_ref;
47201         CHECK(val->arr_len == 32);
47202         memcpy(val_ref.data, val->elems, 32); FREE(val);
47203         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47204 }
47205
47206 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
47207         LDKChannelReestablish this_ptr_conv;
47208         this_ptr_conv.inner = untag_ptr(this_ptr);
47209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47211         this_ptr_conv.is_owned = false;
47212         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47213         return ret_conv;
47214 }
47215
47216 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) {
47217         LDKChannelReestablish this_ptr_conv;
47218         this_ptr_conv.inner = untag_ptr(this_ptr);
47219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47221         this_ptr_conv.is_owned = false;
47222         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47223 }
47224
47225 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
47226         LDKChannelReestablish this_ptr_conv;
47227         this_ptr_conv.inner = untag_ptr(this_ptr);
47228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47230         this_ptr_conv.is_owned = false;
47231         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47232         return ret_conv;
47233 }
47234
47235 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) {
47236         LDKChannelReestablish this_ptr_conv;
47237         this_ptr_conv.inner = untag_ptr(this_ptr);
47238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47240         this_ptr_conv.is_owned = false;
47241         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47242 }
47243
47244 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) {
47245         LDKChannelReestablish this_ptr_conv;
47246         this_ptr_conv.inner = untag_ptr(this_ptr);
47247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47249         this_ptr_conv.is_owned = false;
47250         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47251         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
47252         return ret_arr;
47253 }
47254
47255 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) {
47256         LDKChannelReestablish this_ptr_conv;
47257         this_ptr_conv.inner = untag_ptr(this_ptr);
47258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47260         this_ptr_conv.is_owned = false;
47261         LDKThirtyTwoBytes val_ref;
47262         CHECK(val->arr_len == 32);
47263         memcpy(val_ref.data, val->elems, 32); FREE(val);
47264         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47265 }
47266
47267 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) {
47268         LDKChannelReestablish this_ptr_conv;
47269         this_ptr_conv.inner = untag_ptr(this_ptr);
47270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47272         this_ptr_conv.is_owned = false;
47273         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47274         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47275         return ret_arr;
47276 }
47277
47278 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) {
47279         LDKChannelReestablish this_ptr_conv;
47280         this_ptr_conv.inner = untag_ptr(this_ptr);
47281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47283         this_ptr_conv.is_owned = false;
47284         LDKPublicKey val_ref;
47285         CHECK(val->arr_len == 33);
47286         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47287         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
47288 }
47289
47290 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
47291         LDKChannelReestablish this_ptr_conv;
47292         this_ptr_conv.inner = untag_ptr(this_ptr);
47293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47295         this_ptr_conv.is_owned = false;
47296         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
47297         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
47298         uint64_t ret_ref = tag_ptr(ret_copy, true);
47299         return ret_ref;
47300 }
47301
47302 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
47303         LDKChannelReestablish this_ptr_conv;
47304         this_ptr_conv.inner = untag_ptr(this_ptr);
47305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47307         this_ptr_conv.is_owned = false;
47308         void* val_ptr = untag_ptr(val);
47309         CHECK_ACCESS(val_ptr);
47310         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
47311         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
47312         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
47313 }
47314
47315 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) {
47316         LDKThirtyTwoBytes channel_id_arg_ref;
47317         CHECK(channel_id_arg->arr_len == 32);
47318         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47319         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
47320         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
47321         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
47322         LDKPublicKey my_current_per_commitment_point_arg_ref;
47323         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
47324         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);
47325         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
47326         CHECK_ACCESS(next_funding_txid_arg_ptr);
47327         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
47328         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
47329         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);
47330         uint64_t ret_ref = 0;
47331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47333         return ret_ref;
47334 }
47335
47336 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
47337         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
47338         uint64_t ret_ref = 0;
47339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47341         return ret_ref;
47342 }
47343 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
47344         LDKChannelReestablish arg_conv;
47345         arg_conv.inner = untag_ptr(arg);
47346         arg_conv.is_owned = ptr_is_owned(arg);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47348         arg_conv.is_owned = false;
47349         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
47350         return ret_conv;
47351 }
47352
47353 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
47354         LDKChannelReestablish orig_conv;
47355         orig_conv.inner = untag_ptr(orig);
47356         orig_conv.is_owned = ptr_is_owned(orig);
47357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47358         orig_conv.is_owned = false;
47359         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
47360         uint64_t ret_ref = 0;
47361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47363         return ret_ref;
47364 }
47365
47366 int64_t  __attribute__((export_name("TS_ChannelReestablish_hash"))) TS_ChannelReestablish_hash(uint64_t o) {
47367         LDKChannelReestablish o_conv;
47368         o_conv.inner = untag_ptr(o);
47369         o_conv.is_owned = ptr_is_owned(o);
47370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47371         o_conv.is_owned = false;
47372         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
47373         return ret_conv;
47374 }
47375
47376 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
47377         LDKChannelReestablish a_conv;
47378         a_conv.inner = untag_ptr(a);
47379         a_conv.is_owned = ptr_is_owned(a);
47380         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47381         a_conv.is_owned = false;
47382         LDKChannelReestablish b_conv;
47383         b_conv.inner = untag_ptr(b);
47384         b_conv.is_owned = ptr_is_owned(b);
47385         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47386         b_conv.is_owned = false;
47387         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
47388         return ret_conv;
47389 }
47390
47391 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
47392         LDKAnnouncementSignatures this_obj_conv;
47393         this_obj_conv.inner = untag_ptr(this_obj);
47394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47396         AnnouncementSignatures_free(this_obj_conv);
47397 }
47398
47399 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
47400         LDKAnnouncementSignatures this_ptr_conv;
47401         this_ptr_conv.inner = untag_ptr(this_ptr);
47402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47404         this_ptr_conv.is_owned = false;
47405         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47406         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
47407         return ret_arr;
47408 }
47409
47410 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
47411         LDKAnnouncementSignatures this_ptr_conv;
47412         this_ptr_conv.inner = untag_ptr(this_ptr);
47413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47415         this_ptr_conv.is_owned = false;
47416         LDKThirtyTwoBytes val_ref;
47417         CHECK(val->arr_len == 32);
47418         memcpy(val_ref.data, val->elems, 32); FREE(val);
47419         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
47420 }
47421
47422 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
47423         LDKAnnouncementSignatures this_ptr_conv;
47424         this_ptr_conv.inner = untag_ptr(this_ptr);
47425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47427         this_ptr_conv.is_owned = false;
47428         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
47429         return ret_conv;
47430 }
47431
47432 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
47433         LDKAnnouncementSignatures this_ptr_conv;
47434         this_ptr_conv.inner = untag_ptr(this_ptr);
47435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47437         this_ptr_conv.is_owned = false;
47438         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
47439 }
47440
47441 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
47442         LDKAnnouncementSignatures this_ptr_conv;
47443         this_ptr_conv.inner = untag_ptr(this_ptr);
47444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47446         this_ptr_conv.is_owned = false;
47447         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47448         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
47449         return ret_arr;
47450 }
47451
47452 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
47453         LDKAnnouncementSignatures this_ptr_conv;
47454         this_ptr_conv.inner = untag_ptr(this_ptr);
47455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47457         this_ptr_conv.is_owned = false;
47458         LDKECDSASignature val_ref;
47459         CHECK(val->arr_len == 64);
47460         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47461         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
47462 }
47463
47464 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
47465         LDKAnnouncementSignatures this_ptr_conv;
47466         this_ptr_conv.inner = untag_ptr(this_ptr);
47467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47469         this_ptr_conv.is_owned = false;
47470         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47471         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
47472         return ret_arr;
47473 }
47474
47475 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
47476         LDKAnnouncementSignatures this_ptr_conv;
47477         this_ptr_conv.inner = untag_ptr(this_ptr);
47478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47480         this_ptr_conv.is_owned = false;
47481         LDKECDSASignature val_ref;
47482         CHECK(val->arr_len == 64);
47483         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47484         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
47485 }
47486
47487 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) {
47488         LDKThirtyTwoBytes channel_id_arg_ref;
47489         CHECK(channel_id_arg->arr_len == 32);
47490         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47491         LDKECDSASignature node_signature_arg_ref;
47492         CHECK(node_signature_arg->arr_len == 64);
47493         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
47494         LDKECDSASignature bitcoin_signature_arg_ref;
47495         CHECK(bitcoin_signature_arg->arr_len == 64);
47496         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
47497         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
47498         uint64_t ret_ref = 0;
47499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47501         return ret_ref;
47502 }
47503
47504 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
47505         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
47506         uint64_t ret_ref = 0;
47507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47509         return ret_ref;
47510 }
47511 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
47512         LDKAnnouncementSignatures arg_conv;
47513         arg_conv.inner = untag_ptr(arg);
47514         arg_conv.is_owned = ptr_is_owned(arg);
47515         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47516         arg_conv.is_owned = false;
47517         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
47518         return ret_conv;
47519 }
47520
47521 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
47522         LDKAnnouncementSignatures orig_conv;
47523         orig_conv.inner = untag_ptr(orig);
47524         orig_conv.is_owned = ptr_is_owned(orig);
47525         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47526         orig_conv.is_owned = false;
47527         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
47528         uint64_t ret_ref = 0;
47529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47531         return ret_ref;
47532 }
47533
47534 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_hash"))) TS_AnnouncementSignatures_hash(uint64_t o) {
47535         LDKAnnouncementSignatures o_conv;
47536         o_conv.inner = untag_ptr(o);
47537         o_conv.is_owned = ptr_is_owned(o);
47538         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47539         o_conv.is_owned = false;
47540         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
47541         return ret_conv;
47542 }
47543
47544 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
47545         LDKAnnouncementSignatures a_conv;
47546         a_conv.inner = untag_ptr(a);
47547         a_conv.is_owned = ptr_is_owned(a);
47548         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47549         a_conv.is_owned = false;
47550         LDKAnnouncementSignatures b_conv;
47551         b_conv.inner = untag_ptr(b);
47552         b_conv.is_owned = ptr_is_owned(b);
47553         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47554         b_conv.is_owned = false;
47555         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
47556         return ret_conv;
47557 }
47558
47559 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
47560         if (!ptr_is_owned(this_ptr)) return;
47561         void* this_ptr_ptr = untag_ptr(this_ptr);
47562         CHECK_ACCESS(this_ptr_ptr);
47563         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
47564         FREE(untag_ptr(this_ptr));
47565         SocketAddress_free(this_ptr_conv);
47566 }
47567
47568 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
47569         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47570         *ret_copy = SocketAddress_clone(arg);
47571         uint64_t ret_ref = tag_ptr(ret_copy, true);
47572         return ret_ref;
47573 }
47574 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
47575         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
47576         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
47577         return ret_conv;
47578 }
47579
47580 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
47581         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
47582         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47583         *ret_copy = SocketAddress_clone(orig_conv);
47584         uint64_t ret_ref = tag_ptr(ret_copy, true);
47585         return ret_ref;
47586 }
47587
47588 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
47589         LDKFourBytes addr_ref;
47590         CHECK(addr->arr_len == 4);
47591         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
47592         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47593         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
47594         uint64_t ret_ref = tag_ptr(ret_copy, true);
47595         return ret_ref;
47596 }
47597
47598 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
47599         LDKSixteenBytes addr_ref;
47600         CHECK(addr->arr_len == 16);
47601         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
47602         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47603         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
47604         uint64_t ret_ref = tag_ptr(ret_copy, true);
47605         return ret_ref;
47606 }
47607
47608 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
47609         LDKTwelveBytes a_ref;
47610         CHECK(a->arr_len == 12);
47611         memcpy(a_ref.data, a->elems, 12); FREE(a);
47612         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47613         *ret_copy = SocketAddress_onion_v2(a_ref);
47614         uint64_t ret_ref = tag_ptr(ret_copy, true);
47615         return ret_ref;
47616 }
47617
47618 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) {
47619         LDKThirtyTwoBytes ed25519_pubkey_ref;
47620         CHECK(ed25519_pubkey->arr_len == 32);
47621         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
47622         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47623         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
47624         uint64_t ret_ref = tag_ptr(ret_copy, true);
47625         return ret_ref;
47626 }
47627
47628 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
47629         LDKHostname hostname_conv;
47630         hostname_conv.inner = untag_ptr(hostname);
47631         hostname_conv.is_owned = ptr_is_owned(hostname);
47632         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
47633         hostname_conv = Hostname_clone(&hostname_conv);
47634         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47635         *ret_copy = SocketAddress_hostname(hostname_conv, port);
47636         uint64_t ret_ref = tag_ptr(ret_copy, true);
47637         return ret_ref;
47638 }
47639
47640 int64_t  __attribute__((export_name("TS_SocketAddress_hash"))) TS_SocketAddress_hash(uint64_t o) {
47641         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
47642         int64_t ret_conv = SocketAddress_hash(o_conv);
47643         return ret_conv;
47644 }
47645
47646 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
47647         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
47648         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
47649         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
47650         return ret_conv;
47651 }
47652
47653 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
47654         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
47655         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
47656         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47657         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47658         CVec_u8Z_free(ret_var);
47659         return ret_arr;
47660 }
47661
47662 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
47663         LDKu8slice ser_ref;
47664         ser_ref.datalen = ser->arr_len;
47665         ser_ref.data = ser->elems;
47666         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
47667         *ret_conv = SocketAddress_read(ser_ref);
47668         FREE(ser);
47669         return tag_ptr(ret_conv, true);
47670 }
47671
47672 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
47673         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
47674         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
47675         return ret_conv;
47676 }
47677
47678 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
47679         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
47680         return ret_conv;
47681 }
47682
47683 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
47684         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
47685         return ret_conv;
47686 }
47687
47688 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
47689         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
47690         return ret_conv;
47691 }
47692
47693 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
47694         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
47695         return ret_conv;
47696 }
47697
47698 int64_t  __attribute__((export_name("TS_SocketAddressParseError_hash"))) TS_SocketAddressParseError_hash(uint64_t o) {
47699         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
47700         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
47701         return ret_conv;
47702 }
47703
47704 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
47705         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
47706         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
47707         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
47708         return ret_conv;
47709 }
47710
47711 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
47712         LDKStr host_conv = str_ref_to_owned_c(host);
47713         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
47714         *ret_conv = parse_onion_address(host_conv, port);
47715         return tag_ptr(ret_conv, true);
47716 }
47717
47718 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
47719         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
47720         LDKStr ret_str = SocketAddress_to_str(o_conv);
47721         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47722         Str_free(ret_str);
47723         return ret_conv;
47724 }
47725
47726 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
47727         if (!ptr_is_owned(this_ptr)) return;
47728         void* this_ptr_ptr = untag_ptr(this_ptr);
47729         CHECK_ACCESS(this_ptr_ptr);
47730         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
47731         FREE(untag_ptr(this_ptr));
47732         UnsignedGossipMessage_free(this_ptr_conv);
47733 }
47734
47735 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
47736         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47737         *ret_copy = UnsignedGossipMessage_clone(arg);
47738         uint64_t ret_ref = tag_ptr(ret_copy, true);
47739         return ret_ref;
47740 }
47741 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
47742         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
47743         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
47744         return ret_conv;
47745 }
47746
47747 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
47748         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
47749         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47750         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
47751         uint64_t ret_ref = tag_ptr(ret_copy, true);
47752         return ret_ref;
47753 }
47754
47755 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
47756         LDKUnsignedChannelAnnouncement a_conv;
47757         a_conv.inner = untag_ptr(a);
47758         a_conv.is_owned = ptr_is_owned(a);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47760         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
47761         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47762         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
47763         uint64_t ret_ref = tag_ptr(ret_copy, true);
47764         return ret_ref;
47765 }
47766
47767 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
47768         LDKUnsignedChannelUpdate a_conv;
47769         a_conv.inner = untag_ptr(a);
47770         a_conv.is_owned = ptr_is_owned(a);
47771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47772         a_conv = UnsignedChannelUpdate_clone(&a_conv);
47773         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47774         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
47775         uint64_t ret_ref = tag_ptr(ret_copy, true);
47776         return ret_ref;
47777 }
47778
47779 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
47780         LDKUnsignedNodeAnnouncement a_conv;
47781         a_conv.inner = untag_ptr(a);
47782         a_conv.is_owned = ptr_is_owned(a);
47783         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47784         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
47785         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47786         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
47787         uint64_t ret_ref = tag_ptr(ret_copy, true);
47788         return ret_ref;
47789 }
47790
47791 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
47792         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
47793         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
47794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47796         CVec_u8Z_free(ret_var);
47797         return ret_arr;
47798 }
47799
47800 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
47801         LDKUnsignedNodeAnnouncement this_obj_conv;
47802         this_obj_conv.inner = untag_ptr(this_obj);
47803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47805         UnsignedNodeAnnouncement_free(this_obj_conv);
47806 }
47807
47808 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
47809         LDKUnsignedNodeAnnouncement this_ptr_conv;
47810         this_ptr_conv.inner = untag_ptr(this_ptr);
47811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47813         this_ptr_conv.is_owned = false;
47814         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
47815         uint64_t ret_ref = 0;
47816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47818         return ret_ref;
47819 }
47820
47821 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
47822         LDKUnsignedNodeAnnouncement this_ptr_conv;
47823         this_ptr_conv.inner = untag_ptr(this_ptr);
47824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47826         this_ptr_conv.is_owned = false;
47827         LDKNodeFeatures val_conv;
47828         val_conv.inner = untag_ptr(val);
47829         val_conv.is_owned = ptr_is_owned(val);
47830         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47831         val_conv = NodeFeatures_clone(&val_conv);
47832         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
47833 }
47834
47835 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
47836         LDKUnsignedNodeAnnouncement this_ptr_conv;
47837         this_ptr_conv.inner = untag_ptr(this_ptr);
47838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47840         this_ptr_conv.is_owned = false;
47841         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
47842         return ret_conv;
47843 }
47844
47845 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
47846         LDKUnsignedNodeAnnouncement this_ptr_conv;
47847         this_ptr_conv.inner = untag_ptr(this_ptr);
47848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47850         this_ptr_conv.is_owned = false;
47851         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
47852 }
47853
47854 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
47855         LDKUnsignedNodeAnnouncement this_ptr_conv;
47856         this_ptr_conv.inner = untag_ptr(this_ptr);
47857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47859         this_ptr_conv.is_owned = false;
47860         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
47861         uint64_t ret_ref = 0;
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47864         return ret_ref;
47865 }
47866
47867 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
47868         LDKUnsignedNodeAnnouncement this_ptr_conv;
47869         this_ptr_conv.inner = untag_ptr(this_ptr);
47870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47872         this_ptr_conv.is_owned = false;
47873         LDKNodeId val_conv;
47874         val_conv.inner = untag_ptr(val);
47875         val_conv.is_owned = ptr_is_owned(val);
47876         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47877         val_conv = NodeId_clone(&val_conv);
47878         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
47879 }
47880
47881 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
47882         LDKUnsignedNodeAnnouncement this_ptr_conv;
47883         this_ptr_conv.inner = untag_ptr(this_ptr);
47884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47886         this_ptr_conv.is_owned = false;
47887         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
47888         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
47889         return ret_arr;
47890 }
47891
47892 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
47893         LDKUnsignedNodeAnnouncement this_ptr_conv;
47894         this_ptr_conv.inner = untag_ptr(this_ptr);
47895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47897         this_ptr_conv.is_owned = false;
47898         LDKThreeBytes val_ref;
47899         CHECK(val->arr_len == 3);
47900         memcpy(val_ref.data, val->elems, 3); FREE(val);
47901         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
47902 }
47903
47904 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
47905         LDKUnsignedNodeAnnouncement this_ptr_conv;
47906         this_ptr_conv.inner = untag_ptr(this_ptr);
47907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47909         this_ptr_conv.is_owned = false;
47910         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
47911         uint64_t ret_ref = 0;
47912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47914         return ret_ref;
47915 }
47916
47917 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
47918         LDKUnsignedNodeAnnouncement this_ptr_conv;
47919         this_ptr_conv.inner = untag_ptr(this_ptr);
47920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47922         this_ptr_conv.is_owned = false;
47923         LDKNodeAlias val_conv;
47924         val_conv.inner = untag_ptr(val);
47925         val_conv.is_owned = ptr_is_owned(val);
47926         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47927         val_conv = NodeAlias_clone(&val_conv);
47928         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
47929 }
47930
47931 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
47932         LDKUnsignedNodeAnnouncement this_ptr_conv;
47933         this_ptr_conv.inner = untag_ptr(this_ptr);
47934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47936         this_ptr_conv.is_owned = false;
47937         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
47938         uint64_tArray ret_arr = NULL;
47939         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47940         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47941         for (size_t p = 0; p < ret_var.datalen; p++) {
47942                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47943                 *ret_conv_15_copy = ret_var.data[p];
47944                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
47945                 ret_arr_ptr[p] = ret_conv_15_ref;
47946         }
47947         
47948         FREE(ret_var.data);
47949         return ret_arr;
47950 }
47951
47952 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
47953         LDKUnsignedNodeAnnouncement this_ptr_conv;
47954         this_ptr_conv.inner = untag_ptr(this_ptr);
47955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47957         this_ptr_conv.is_owned = false;
47958         LDKCVec_SocketAddressZ val_constr;
47959         val_constr.datalen = val->arr_len;
47960         if (val_constr.datalen > 0)
47961                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
47962         else
47963                 val_constr.data = NULL;
47964         uint64_t* val_vals = val->elems;
47965         for (size_t p = 0; p < val_constr.datalen; p++) {
47966                 uint64_t val_conv_15 = val_vals[p];
47967                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
47968                 CHECK_ACCESS(val_conv_15_ptr);
47969                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
47970                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
47971                 val_constr.data[p] = val_conv_15_conv;
47972         }
47973         FREE(val);
47974         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
47975 }
47976
47977 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
47978         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
47979         uint64_t ret_ref = 0;
47980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47982         return ret_ref;
47983 }
47984 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
47985         LDKUnsignedNodeAnnouncement arg_conv;
47986         arg_conv.inner = untag_ptr(arg);
47987         arg_conv.is_owned = ptr_is_owned(arg);
47988         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47989         arg_conv.is_owned = false;
47990         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
47991         return ret_conv;
47992 }
47993
47994 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
47995         LDKUnsignedNodeAnnouncement orig_conv;
47996         orig_conv.inner = untag_ptr(orig);
47997         orig_conv.is_owned = ptr_is_owned(orig);
47998         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47999         orig_conv.is_owned = false;
48000         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48001         uint64_t ret_ref = 0;
48002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48004         return ret_ref;
48005 }
48006
48007 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_hash"))) TS_UnsignedNodeAnnouncement_hash(uint64_t o) {
48008         LDKUnsignedNodeAnnouncement o_conv;
48009         o_conv.inner = untag_ptr(o);
48010         o_conv.is_owned = ptr_is_owned(o);
48011         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48012         o_conv.is_owned = false;
48013         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
48014         return ret_conv;
48015 }
48016
48017 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
48018         LDKUnsignedNodeAnnouncement a_conv;
48019         a_conv.inner = untag_ptr(a);
48020         a_conv.is_owned = ptr_is_owned(a);
48021         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48022         a_conv.is_owned = false;
48023         LDKUnsignedNodeAnnouncement b_conv;
48024         b_conv.inner = untag_ptr(b);
48025         b_conv.is_owned = ptr_is_owned(b);
48026         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48027         b_conv.is_owned = false;
48028         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48029         return ret_conv;
48030 }
48031
48032 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
48033         LDKNodeAnnouncement this_obj_conv;
48034         this_obj_conv.inner = untag_ptr(this_obj);
48035         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48037         NodeAnnouncement_free(this_obj_conv);
48038 }
48039
48040 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
48041         LDKNodeAnnouncement this_ptr_conv;
48042         this_ptr_conv.inner = untag_ptr(this_ptr);
48043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48045         this_ptr_conv.is_owned = false;
48046         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48047         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
48048         return ret_arr;
48049 }
48050
48051 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
48052         LDKNodeAnnouncement this_ptr_conv;
48053         this_ptr_conv.inner = untag_ptr(this_ptr);
48054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48056         this_ptr_conv.is_owned = false;
48057         LDKECDSASignature val_ref;
48058         CHECK(val->arr_len == 64);
48059         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48060         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48061 }
48062
48063 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
48064         LDKNodeAnnouncement this_ptr_conv;
48065         this_ptr_conv.inner = untag_ptr(this_ptr);
48066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48068         this_ptr_conv.is_owned = false;
48069         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48070         uint64_t ret_ref = 0;
48071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48073         return ret_ref;
48074 }
48075
48076 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
48077         LDKNodeAnnouncement this_ptr_conv;
48078         this_ptr_conv.inner = untag_ptr(this_ptr);
48079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48081         this_ptr_conv.is_owned = false;
48082         LDKUnsignedNodeAnnouncement val_conv;
48083         val_conv.inner = untag_ptr(val);
48084         val_conv.is_owned = ptr_is_owned(val);
48085         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48086         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48087         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48088 }
48089
48090 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
48091         LDKECDSASignature signature_arg_ref;
48092         CHECK(signature_arg->arr_len == 64);
48093         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48094         LDKUnsignedNodeAnnouncement contents_arg_conv;
48095         contents_arg_conv.inner = untag_ptr(contents_arg);
48096         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48097         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48098         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48099         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48100         uint64_t ret_ref = 0;
48101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48103         return ret_ref;
48104 }
48105
48106 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48107         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48108         uint64_t ret_ref = 0;
48109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48111         return ret_ref;
48112 }
48113 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
48114         LDKNodeAnnouncement arg_conv;
48115         arg_conv.inner = untag_ptr(arg);
48116         arg_conv.is_owned = ptr_is_owned(arg);
48117         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48118         arg_conv.is_owned = false;
48119         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48120         return ret_conv;
48121 }
48122
48123 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
48124         LDKNodeAnnouncement orig_conv;
48125         orig_conv.inner = untag_ptr(orig);
48126         orig_conv.is_owned = ptr_is_owned(orig);
48127         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48128         orig_conv.is_owned = false;
48129         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48130         uint64_t ret_ref = 0;
48131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48133         return ret_ref;
48134 }
48135
48136 int64_t  __attribute__((export_name("TS_NodeAnnouncement_hash"))) TS_NodeAnnouncement_hash(uint64_t o) {
48137         LDKNodeAnnouncement o_conv;
48138         o_conv.inner = untag_ptr(o);
48139         o_conv.is_owned = ptr_is_owned(o);
48140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48141         o_conv.is_owned = false;
48142         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
48143         return ret_conv;
48144 }
48145
48146 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
48147         LDKNodeAnnouncement a_conv;
48148         a_conv.inner = untag_ptr(a);
48149         a_conv.is_owned = ptr_is_owned(a);
48150         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48151         a_conv.is_owned = false;
48152         LDKNodeAnnouncement b_conv;
48153         b_conv.inner = untag_ptr(b);
48154         b_conv.is_owned = ptr_is_owned(b);
48155         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48156         b_conv.is_owned = false;
48157         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48158         return ret_conv;
48159 }
48160
48161 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
48162         LDKUnsignedChannelAnnouncement this_obj_conv;
48163         this_obj_conv.inner = untag_ptr(this_obj);
48164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48166         UnsignedChannelAnnouncement_free(this_obj_conv);
48167 }
48168
48169 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
48170         LDKUnsignedChannelAnnouncement this_ptr_conv;
48171         this_ptr_conv.inner = untag_ptr(this_ptr);
48172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48174         this_ptr_conv.is_owned = false;
48175         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48176         uint64_t ret_ref = 0;
48177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48179         return ret_ref;
48180 }
48181
48182 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
48183         LDKUnsignedChannelAnnouncement this_ptr_conv;
48184         this_ptr_conv.inner = untag_ptr(this_ptr);
48185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48187         this_ptr_conv.is_owned = false;
48188         LDKChannelFeatures val_conv;
48189         val_conv.inner = untag_ptr(val);
48190         val_conv.is_owned = ptr_is_owned(val);
48191         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48192         val_conv = ChannelFeatures_clone(&val_conv);
48193         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48194 }
48195
48196 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
48197         LDKUnsignedChannelAnnouncement this_ptr_conv;
48198         this_ptr_conv.inner = untag_ptr(this_ptr);
48199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48201         this_ptr_conv.is_owned = false;
48202         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48203         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
48204         return ret_arr;
48205 }
48206
48207 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
48208         LDKUnsignedChannelAnnouncement this_ptr_conv;
48209         this_ptr_conv.inner = untag_ptr(this_ptr);
48210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48212         this_ptr_conv.is_owned = false;
48213         LDKThirtyTwoBytes val_ref;
48214         CHECK(val->arr_len == 32);
48215         memcpy(val_ref.data, val->elems, 32); FREE(val);
48216         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48217 }
48218
48219 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
48220         LDKUnsignedChannelAnnouncement this_ptr_conv;
48221         this_ptr_conv.inner = untag_ptr(this_ptr);
48222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48224         this_ptr_conv.is_owned = false;
48225         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48226         return ret_conv;
48227 }
48228
48229 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
48230         LDKUnsignedChannelAnnouncement this_ptr_conv;
48231         this_ptr_conv.inner = untag_ptr(this_ptr);
48232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48234         this_ptr_conv.is_owned = false;
48235         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48236 }
48237
48238 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
48239         LDKUnsignedChannelAnnouncement this_ptr_conv;
48240         this_ptr_conv.inner = untag_ptr(this_ptr);
48241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48243         this_ptr_conv.is_owned = false;
48244         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48245         uint64_t ret_ref = 0;
48246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48248         return ret_ref;
48249 }
48250
48251 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
48252         LDKUnsignedChannelAnnouncement this_ptr_conv;
48253         this_ptr_conv.inner = untag_ptr(this_ptr);
48254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48256         this_ptr_conv.is_owned = false;
48257         LDKNodeId val_conv;
48258         val_conv.inner = untag_ptr(val);
48259         val_conv.is_owned = ptr_is_owned(val);
48260         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48261         val_conv = NodeId_clone(&val_conv);
48262         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48263 }
48264
48265 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
48266         LDKUnsignedChannelAnnouncement this_ptr_conv;
48267         this_ptr_conv.inner = untag_ptr(this_ptr);
48268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48270         this_ptr_conv.is_owned = false;
48271         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48272         uint64_t ret_ref = 0;
48273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48275         return ret_ref;
48276 }
48277
48278 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
48279         LDKUnsignedChannelAnnouncement this_ptr_conv;
48280         this_ptr_conv.inner = untag_ptr(this_ptr);
48281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48283         this_ptr_conv.is_owned = false;
48284         LDKNodeId val_conv;
48285         val_conv.inner = untag_ptr(val);
48286         val_conv.is_owned = ptr_is_owned(val);
48287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48288         val_conv = NodeId_clone(&val_conv);
48289         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48290 }
48291
48292 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
48293         LDKUnsignedChannelAnnouncement this_ptr_conv;
48294         this_ptr_conv.inner = untag_ptr(this_ptr);
48295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48297         this_ptr_conv.is_owned = false;
48298         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48299         uint64_t ret_ref = 0;
48300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48302         return ret_ref;
48303 }
48304
48305 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
48306         LDKUnsignedChannelAnnouncement this_ptr_conv;
48307         this_ptr_conv.inner = untag_ptr(this_ptr);
48308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48310         this_ptr_conv.is_owned = false;
48311         LDKNodeId val_conv;
48312         val_conv.inner = untag_ptr(val);
48313         val_conv.is_owned = ptr_is_owned(val);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48315         val_conv = NodeId_clone(&val_conv);
48316         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
48317 }
48318
48319 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
48320         LDKUnsignedChannelAnnouncement this_ptr_conv;
48321         this_ptr_conv.inner = untag_ptr(this_ptr);
48322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48324         this_ptr_conv.is_owned = false;
48325         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
48326         uint64_t ret_ref = 0;
48327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48329         return ret_ref;
48330 }
48331
48332 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
48333         LDKUnsignedChannelAnnouncement this_ptr_conv;
48334         this_ptr_conv.inner = untag_ptr(this_ptr);
48335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48337         this_ptr_conv.is_owned = false;
48338         LDKNodeId val_conv;
48339         val_conv.inner = untag_ptr(val);
48340         val_conv.is_owned = ptr_is_owned(val);
48341         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48342         val_conv = NodeId_clone(&val_conv);
48343         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
48344 }
48345
48346 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
48347         LDKUnsignedChannelAnnouncement this_ptr_conv;
48348         this_ptr_conv.inner = untag_ptr(this_ptr);
48349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48351         this_ptr_conv.is_owned = false;
48352         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
48353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48355         CVec_u8Z_free(ret_var);
48356         return ret_arr;
48357 }
48358
48359 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
48360         LDKUnsignedChannelAnnouncement this_ptr_conv;
48361         this_ptr_conv.inner = untag_ptr(this_ptr);
48362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48364         this_ptr_conv.is_owned = false;
48365         LDKCVec_u8Z val_ref;
48366         val_ref.datalen = val->arr_len;
48367         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48368         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48369         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
48370 }
48371
48372 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) {
48373         LDKChannelFeatures features_arg_conv;
48374         features_arg_conv.inner = untag_ptr(features_arg);
48375         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48376         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48377         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
48378         LDKThirtyTwoBytes chain_hash_arg_ref;
48379         CHECK(chain_hash_arg->arr_len == 32);
48380         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48381         LDKNodeId node_id_1_arg_conv;
48382         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
48383         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
48384         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
48385         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
48386         LDKNodeId node_id_2_arg_conv;
48387         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
48388         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
48389         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
48390         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
48391         LDKNodeId bitcoin_key_1_arg_conv;
48392         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
48393         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
48394         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
48395         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
48396         LDKNodeId bitcoin_key_2_arg_conv;
48397         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
48398         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
48399         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
48400         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
48401         LDKCVec_u8Z excess_data_arg_ref;
48402         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
48403         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48404         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
48405         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);
48406         uint64_t ret_ref = 0;
48407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48409         return ret_ref;
48410 }
48411
48412 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
48413         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
48414         uint64_t ret_ref = 0;
48415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48417         return ret_ref;
48418 }
48419 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
48420         LDKUnsignedChannelAnnouncement arg_conv;
48421         arg_conv.inner = untag_ptr(arg);
48422         arg_conv.is_owned = ptr_is_owned(arg);
48423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48424         arg_conv.is_owned = false;
48425         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
48426         return ret_conv;
48427 }
48428
48429 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
48430         LDKUnsignedChannelAnnouncement orig_conv;
48431         orig_conv.inner = untag_ptr(orig);
48432         orig_conv.is_owned = ptr_is_owned(orig);
48433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48434         orig_conv.is_owned = false;
48435         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
48436         uint64_t ret_ref = 0;
48437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48439         return ret_ref;
48440 }
48441
48442 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_hash"))) TS_UnsignedChannelAnnouncement_hash(uint64_t o) {
48443         LDKUnsignedChannelAnnouncement o_conv;
48444         o_conv.inner = untag_ptr(o);
48445         o_conv.is_owned = ptr_is_owned(o);
48446         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48447         o_conv.is_owned = false;
48448         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
48449         return ret_conv;
48450 }
48451
48452 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
48453         LDKUnsignedChannelAnnouncement a_conv;
48454         a_conv.inner = untag_ptr(a);
48455         a_conv.is_owned = ptr_is_owned(a);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48457         a_conv.is_owned = false;
48458         LDKUnsignedChannelAnnouncement b_conv;
48459         b_conv.inner = untag_ptr(b);
48460         b_conv.is_owned = ptr_is_owned(b);
48461         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48462         b_conv.is_owned = false;
48463         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
48464         return ret_conv;
48465 }
48466
48467 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
48468         LDKChannelAnnouncement this_obj_conv;
48469         this_obj_conv.inner = untag_ptr(this_obj);
48470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48472         ChannelAnnouncement_free(this_obj_conv);
48473 }
48474
48475 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
48476         LDKChannelAnnouncement this_ptr_conv;
48477         this_ptr_conv.inner = untag_ptr(this_ptr);
48478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48480         this_ptr_conv.is_owned = false;
48481         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48482         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
48483         return ret_arr;
48484 }
48485
48486 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
48487         LDKChannelAnnouncement this_ptr_conv;
48488         this_ptr_conv.inner = untag_ptr(this_ptr);
48489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48491         this_ptr_conv.is_owned = false;
48492         LDKECDSASignature val_ref;
48493         CHECK(val->arr_len == 64);
48494         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48495         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
48496 }
48497
48498 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
48499         LDKChannelAnnouncement this_ptr_conv;
48500         this_ptr_conv.inner = untag_ptr(this_ptr);
48501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48503         this_ptr_conv.is_owned = false;
48504         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48505         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
48506         return ret_arr;
48507 }
48508
48509 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
48510         LDKChannelAnnouncement this_ptr_conv;
48511         this_ptr_conv.inner = untag_ptr(this_ptr);
48512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48514         this_ptr_conv.is_owned = false;
48515         LDKECDSASignature val_ref;
48516         CHECK(val->arr_len == 64);
48517         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48518         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
48519 }
48520
48521 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
48522         LDKChannelAnnouncement this_ptr_conv;
48523         this_ptr_conv.inner = untag_ptr(this_ptr);
48524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48526         this_ptr_conv.is_owned = false;
48527         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48528         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
48529         return ret_arr;
48530 }
48531
48532 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
48533         LDKChannelAnnouncement this_ptr_conv;
48534         this_ptr_conv.inner = untag_ptr(this_ptr);
48535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48537         this_ptr_conv.is_owned = false;
48538         LDKECDSASignature val_ref;
48539         CHECK(val->arr_len == 64);
48540         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48541         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
48542 }
48543
48544 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
48545         LDKChannelAnnouncement this_ptr_conv;
48546         this_ptr_conv.inner = untag_ptr(this_ptr);
48547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48549         this_ptr_conv.is_owned = false;
48550         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48551         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
48552         return ret_arr;
48553 }
48554
48555 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
48556         LDKChannelAnnouncement this_ptr_conv;
48557         this_ptr_conv.inner = untag_ptr(this_ptr);
48558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48560         this_ptr_conv.is_owned = false;
48561         LDKECDSASignature val_ref;
48562         CHECK(val->arr_len == 64);
48563         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48564         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
48565 }
48566
48567 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
48568         LDKChannelAnnouncement this_ptr_conv;
48569         this_ptr_conv.inner = untag_ptr(this_ptr);
48570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48572         this_ptr_conv.is_owned = false;
48573         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
48574         uint64_t ret_ref = 0;
48575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48577         return ret_ref;
48578 }
48579
48580 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
48581         LDKChannelAnnouncement this_ptr_conv;
48582         this_ptr_conv.inner = untag_ptr(this_ptr);
48583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48585         this_ptr_conv.is_owned = false;
48586         LDKUnsignedChannelAnnouncement val_conv;
48587         val_conv.inner = untag_ptr(val);
48588         val_conv.is_owned = ptr_is_owned(val);
48589         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48590         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
48591         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
48592 }
48593
48594 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) {
48595         LDKECDSASignature node_signature_1_arg_ref;
48596         CHECK(node_signature_1_arg->arr_len == 64);
48597         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
48598         LDKECDSASignature node_signature_2_arg_ref;
48599         CHECK(node_signature_2_arg->arr_len == 64);
48600         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
48601         LDKECDSASignature bitcoin_signature_1_arg_ref;
48602         CHECK(bitcoin_signature_1_arg->arr_len == 64);
48603         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
48604         LDKECDSASignature bitcoin_signature_2_arg_ref;
48605         CHECK(bitcoin_signature_2_arg->arr_len == 64);
48606         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
48607         LDKUnsignedChannelAnnouncement contents_arg_conv;
48608         contents_arg_conv.inner = untag_ptr(contents_arg);
48609         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48610         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48611         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
48612         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);
48613         uint64_t ret_ref = 0;
48614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48616         return ret_ref;
48617 }
48618
48619 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
48620         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
48621         uint64_t ret_ref = 0;
48622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48624         return ret_ref;
48625 }
48626 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
48627         LDKChannelAnnouncement arg_conv;
48628         arg_conv.inner = untag_ptr(arg);
48629         arg_conv.is_owned = ptr_is_owned(arg);
48630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48631         arg_conv.is_owned = false;
48632         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
48633         return ret_conv;
48634 }
48635
48636 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
48637         LDKChannelAnnouncement orig_conv;
48638         orig_conv.inner = untag_ptr(orig);
48639         orig_conv.is_owned = ptr_is_owned(orig);
48640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48641         orig_conv.is_owned = false;
48642         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
48643         uint64_t ret_ref = 0;
48644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48646         return ret_ref;
48647 }
48648
48649 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_hash"))) TS_ChannelAnnouncement_hash(uint64_t o) {
48650         LDKChannelAnnouncement o_conv;
48651         o_conv.inner = untag_ptr(o);
48652         o_conv.is_owned = ptr_is_owned(o);
48653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48654         o_conv.is_owned = false;
48655         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
48656         return ret_conv;
48657 }
48658
48659 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
48660         LDKChannelAnnouncement a_conv;
48661         a_conv.inner = untag_ptr(a);
48662         a_conv.is_owned = ptr_is_owned(a);
48663         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48664         a_conv.is_owned = false;
48665         LDKChannelAnnouncement b_conv;
48666         b_conv.inner = untag_ptr(b);
48667         b_conv.is_owned = ptr_is_owned(b);
48668         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48669         b_conv.is_owned = false;
48670         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
48671         return ret_conv;
48672 }
48673
48674 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
48675         LDKUnsignedChannelUpdate this_obj_conv;
48676         this_obj_conv.inner = untag_ptr(this_obj);
48677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48679         UnsignedChannelUpdate_free(this_obj_conv);
48680 }
48681
48682 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
48683         LDKUnsignedChannelUpdate this_ptr_conv;
48684         this_ptr_conv.inner = untag_ptr(this_ptr);
48685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48687         this_ptr_conv.is_owned = false;
48688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48689         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
48690         return ret_arr;
48691 }
48692
48693 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
48694         LDKUnsignedChannelUpdate this_ptr_conv;
48695         this_ptr_conv.inner = untag_ptr(this_ptr);
48696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48698         this_ptr_conv.is_owned = false;
48699         LDKThirtyTwoBytes val_ref;
48700         CHECK(val->arr_len == 32);
48701         memcpy(val_ref.data, val->elems, 32); FREE(val);
48702         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
48703 }
48704
48705 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
48706         LDKUnsignedChannelUpdate this_ptr_conv;
48707         this_ptr_conv.inner = untag_ptr(this_ptr);
48708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48710         this_ptr_conv.is_owned = false;
48711         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
48712         return ret_conv;
48713 }
48714
48715 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
48716         LDKUnsignedChannelUpdate this_ptr_conv;
48717         this_ptr_conv.inner = untag_ptr(this_ptr);
48718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48720         this_ptr_conv.is_owned = false;
48721         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
48722 }
48723
48724 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
48725         LDKUnsignedChannelUpdate this_ptr_conv;
48726         this_ptr_conv.inner = untag_ptr(this_ptr);
48727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48729         this_ptr_conv.is_owned = false;
48730         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
48731         return ret_conv;
48732 }
48733
48734 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
48735         LDKUnsignedChannelUpdate this_ptr_conv;
48736         this_ptr_conv.inner = untag_ptr(this_ptr);
48737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48739         this_ptr_conv.is_owned = false;
48740         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
48741 }
48742
48743 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
48744         LDKUnsignedChannelUpdate this_ptr_conv;
48745         this_ptr_conv.inner = untag_ptr(this_ptr);
48746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48748         this_ptr_conv.is_owned = false;
48749         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
48750         return ret_conv;
48751 }
48752
48753 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
48754         LDKUnsignedChannelUpdate this_ptr_conv;
48755         this_ptr_conv.inner = untag_ptr(this_ptr);
48756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48758         this_ptr_conv.is_owned = false;
48759         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
48760 }
48761
48762 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
48763         LDKUnsignedChannelUpdate this_ptr_conv;
48764         this_ptr_conv.inner = untag_ptr(this_ptr);
48765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48767         this_ptr_conv.is_owned = false;
48768         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
48769         return ret_conv;
48770 }
48771
48772 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
48773         LDKUnsignedChannelUpdate this_ptr_conv;
48774         this_ptr_conv.inner = untag_ptr(this_ptr);
48775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48777         this_ptr_conv.is_owned = false;
48778         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
48779 }
48780
48781 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
48782         LDKUnsignedChannelUpdate this_ptr_conv;
48783         this_ptr_conv.inner = untag_ptr(this_ptr);
48784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48786         this_ptr_conv.is_owned = false;
48787         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
48788         return ret_conv;
48789 }
48790
48791 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
48792         LDKUnsignedChannelUpdate this_ptr_conv;
48793         this_ptr_conv.inner = untag_ptr(this_ptr);
48794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48796         this_ptr_conv.is_owned = false;
48797         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
48798 }
48799
48800 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
48801         LDKUnsignedChannelUpdate this_ptr_conv;
48802         this_ptr_conv.inner = untag_ptr(this_ptr);
48803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48805         this_ptr_conv.is_owned = false;
48806         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
48807         return ret_conv;
48808 }
48809
48810 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
48811         LDKUnsignedChannelUpdate this_ptr_conv;
48812         this_ptr_conv.inner = untag_ptr(this_ptr);
48813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48815         this_ptr_conv.is_owned = false;
48816         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
48817 }
48818
48819 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
48820         LDKUnsignedChannelUpdate this_ptr_conv;
48821         this_ptr_conv.inner = untag_ptr(this_ptr);
48822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48824         this_ptr_conv.is_owned = false;
48825         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
48826         return ret_conv;
48827 }
48828
48829 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
48830         LDKUnsignedChannelUpdate this_ptr_conv;
48831         this_ptr_conv.inner = untag_ptr(this_ptr);
48832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48834         this_ptr_conv.is_owned = false;
48835         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
48836 }
48837
48838 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
48839         LDKUnsignedChannelUpdate this_ptr_conv;
48840         this_ptr_conv.inner = untag_ptr(this_ptr);
48841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48843         this_ptr_conv.is_owned = false;
48844         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
48845         return ret_conv;
48846 }
48847
48848 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
48849         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
48855 }
48856
48857 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
48858         LDKUnsignedChannelUpdate this_ptr_conv;
48859         this_ptr_conv.inner = untag_ptr(this_ptr);
48860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48862         this_ptr_conv.is_owned = false;
48863         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
48864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48866         CVec_u8Z_free(ret_var);
48867         return ret_arr;
48868 }
48869
48870 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
48871         LDKUnsignedChannelUpdate this_ptr_conv;
48872         this_ptr_conv.inner = untag_ptr(this_ptr);
48873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48875         this_ptr_conv.is_owned = false;
48876         LDKCVec_u8Z val_ref;
48877         val_ref.datalen = val->arr_len;
48878         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48879         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48880         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
48881 }
48882
48883 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) {
48884         LDKThirtyTwoBytes chain_hash_arg_ref;
48885         CHECK(chain_hash_arg->arr_len == 32);
48886         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48887         LDKCVec_u8Z excess_data_arg_ref;
48888         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
48889         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48890         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
48891         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);
48892         uint64_t ret_ref = 0;
48893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48895         return ret_ref;
48896 }
48897
48898 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
48899         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
48900         uint64_t ret_ref = 0;
48901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48903         return ret_ref;
48904 }
48905 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
48906         LDKUnsignedChannelUpdate arg_conv;
48907         arg_conv.inner = untag_ptr(arg);
48908         arg_conv.is_owned = ptr_is_owned(arg);
48909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48910         arg_conv.is_owned = false;
48911         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
48912         return ret_conv;
48913 }
48914
48915 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
48916         LDKUnsignedChannelUpdate orig_conv;
48917         orig_conv.inner = untag_ptr(orig);
48918         orig_conv.is_owned = ptr_is_owned(orig);
48919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48920         orig_conv.is_owned = false;
48921         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
48922         uint64_t ret_ref = 0;
48923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48925         return ret_ref;
48926 }
48927
48928 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_hash"))) TS_UnsignedChannelUpdate_hash(uint64_t o) {
48929         LDKUnsignedChannelUpdate o_conv;
48930         o_conv.inner = untag_ptr(o);
48931         o_conv.is_owned = ptr_is_owned(o);
48932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48933         o_conv.is_owned = false;
48934         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
48935         return ret_conv;
48936 }
48937
48938 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
48939         LDKUnsignedChannelUpdate a_conv;
48940         a_conv.inner = untag_ptr(a);
48941         a_conv.is_owned = ptr_is_owned(a);
48942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48943         a_conv.is_owned = false;
48944         LDKUnsignedChannelUpdate b_conv;
48945         b_conv.inner = untag_ptr(b);
48946         b_conv.is_owned = ptr_is_owned(b);
48947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48948         b_conv.is_owned = false;
48949         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
48950         return ret_conv;
48951 }
48952
48953 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
48954         LDKChannelUpdate this_obj_conv;
48955         this_obj_conv.inner = untag_ptr(this_obj);
48956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48958         ChannelUpdate_free(this_obj_conv);
48959 }
48960
48961 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
48962         LDKChannelUpdate this_ptr_conv;
48963         this_ptr_conv.inner = untag_ptr(this_ptr);
48964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48966         this_ptr_conv.is_owned = false;
48967         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48968         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
48969         return ret_arr;
48970 }
48971
48972 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
48973         LDKChannelUpdate this_ptr_conv;
48974         this_ptr_conv.inner = untag_ptr(this_ptr);
48975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48977         this_ptr_conv.is_owned = false;
48978         LDKECDSASignature val_ref;
48979         CHECK(val->arr_len == 64);
48980         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48981         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
48982 }
48983
48984 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
48985         LDKChannelUpdate this_ptr_conv;
48986         this_ptr_conv.inner = untag_ptr(this_ptr);
48987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48989         this_ptr_conv.is_owned = false;
48990         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
48991         uint64_t ret_ref = 0;
48992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48994         return ret_ref;
48995 }
48996
48997 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
48998         LDKChannelUpdate this_ptr_conv;
48999         this_ptr_conv.inner = untag_ptr(this_ptr);
49000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49002         this_ptr_conv.is_owned = false;
49003         LDKUnsignedChannelUpdate val_conv;
49004         val_conv.inner = untag_ptr(val);
49005         val_conv.is_owned = ptr_is_owned(val);
49006         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49007         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49008         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49009 }
49010
49011 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
49012         LDKECDSASignature signature_arg_ref;
49013         CHECK(signature_arg->arr_len == 64);
49014         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49015         LDKUnsignedChannelUpdate contents_arg_conv;
49016         contents_arg_conv.inner = untag_ptr(contents_arg);
49017         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49018         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49019         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49020         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49021         uint64_t ret_ref = 0;
49022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49024         return ret_ref;
49025 }
49026
49027 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49028         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49029         uint64_t ret_ref = 0;
49030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49032         return ret_ref;
49033 }
49034 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
49035         LDKChannelUpdate arg_conv;
49036         arg_conv.inner = untag_ptr(arg);
49037         arg_conv.is_owned = ptr_is_owned(arg);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49039         arg_conv.is_owned = false;
49040         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49041         return ret_conv;
49042 }
49043
49044 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
49045         LDKChannelUpdate orig_conv;
49046         orig_conv.inner = untag_ptr(orig);
49047         orig_conv.is_owned = ptr_is_owned(orig);
49048         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49049         orig_conv.is_owned = false;
49050         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49051         uint64_t ret_ref = 0;
49052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49054         return ret_ref;
49055 }
49056
49057 int64_t  __attribute__((export_name("TS_ChannelUpdate_hash"))) TS_ChannelUpdate_hash(uint64_t o) {
49058         LDKChannelUpdate o_conv;
49059         o_conv.inner = untag_ptr(o);
49060         o_conv.is_owned = ptr_is_owned(o);
49061         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49062         o_conv.is_owned = false;
49063         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
49064         return ret_conv;
49065 }
49066
49067 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
49068         LDKChannelUpdate a_conv;
49069         a_conv.inner = untag_ptr(a);
49070         a_conv.is_owned = ptr_is_owned(a);
49071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49072         a_conv.is_owned = false;
49073         LDKChannelUpdate b_conv;
49074         b_conv.inner = untag_ptr(b);
49075         b_conv.is_owned = ptr_is_owned(b);
49076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49077         b_conv.is_owned = false;
49078         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49079         return ret_conv;
49080 }
49081
49082 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
49083         LDKQueryChannelRange this_obj_conv;
49084         this_obj_conv.inner = untag_ptr(this_obj);
49085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49087         QueryChannelRange_free(this_obj_conv);
49088 }
49089
49090 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
49091         LDKQueryChannelRange this_ptr_conv;
49092         this_ptr_conv.inner = untag_ptr(this_ptr);
49093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49095         this_ptr_conv.is_owned = false;
49096         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49097         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
49098         return ret_arr;
49099 }
49100
49101 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49102         LDKQueryChannelRange this_ptr_conv;
49103         this_ptr_conv.inner = untag_ptr(this_ptr);
49104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49106         this_ptr_conv.is_owned = false;
49107         LDKThirtyTwoBytes val_ref;
49108         CHECK(val->arr_len == 32);
49109         memcpy(val_ref.data, val->elems, 32); FREE(val);
49110         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49111 }
49112
49113 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
49114         LDKQueryChannelRange this_ptr_conv;
49115         this_ptr_conv.inner = untag_ptr(this_ptr);
49116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49118         this_ptr_conv.is_owned = false;
49119         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49120         return ret_conv;
49121 }
49122
49123 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
49124         LDKQueryChannelRange this_ptr_conv;
49125         this_ptr_conv.inner = untag_ptr(this_ptr);
49126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49128         this_ptr_conv.is_owned = false;
49129         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49130 }
49131
49132 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
49133         LDKQueryChannelRange this_ptr_conv;
49134         this_ptr_conv.inner = untag_ptr(this_ptr);
49135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49137         this_ptr_conv.is_owned = false;
49138         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49139         return ret_conv;
49140 }
49141
49142 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
49143         LDKQueryChannelRange this_ptr_conv;
49144         this_ptr_conv.inner = untag_ptr(this_ptr);
49145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49147         this_ptr_conv.is_owned = false;
49148         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49149 }
49150
49151 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) {
49152         LDKThirtyTwoBytes chain_hash_arg_ref;
49153         CHECK(chain_hash_arg->arr_len == 32);
49154         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49155         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49156         uint64_t ret_ref = 0;
49157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49159         return ret_ref;
49160 }
49161
49162 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49163         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49164         uint64_t ret_ref = 0;
49165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49167         return ret_ref;
49168 }
49169 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
49170         LDKQueryChannelRange arg_conv;
49171         arg_conv.inner = untag_ptr(arg);
49172         arg_conv.is_owned = ptr_is_owned(arg);
49173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49174         arg_conv.is_owned = false;
49175         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49176         return ret_conv;
49177 }
49178
49179 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
49180         LDKQueryChannelRange orig_conv;
49181         orig_conv.inner = untag_ptr(orig);
49182         orig_conv.is_owned = ptr_is_owned(orig);
49183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49184         orig_conv.is_owned = false;
49185         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49186         uint64_t ret_ref = 0;
49187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49189         return ret_ref;
49190 }
49191
49192 int64_t  __attribute__((export_name("TS_QueryChannelRange_hash"))) TS_QueryChannelRange_hash(uint64_t o) {
49193         LDKQueryChannelRange o_conv;
49194         o_conv.inner = untag_ptr(o);
49195         o_conv.is_owned = ptr_is_owned(o);
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49197         o_conv.is_owned = false;
49198         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
49199         return ret_conv;
49200 }
49201
49202 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
49203         LDKQueryChannelRange a_conv;
49204         a_conv.inner = untag_ptr(a);
49205         a_conv.is_owned = ptr_is_owned(a);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49207         a_conv.is_owned = false;
49208         LDKQueryChannelRange b_conv;
49209         b_conv.inner = untag_ptr(b);
49210         b_conv.is_owned = ptr_is_owned(b);
49211         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49212         b_conv.is_owned = false;
49213         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49214         return ret_conv;
49215 }
49216
49217 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
49218         LDKReplyChannelRange this_obj_conv;
49219         this_obj_conv.inner = untag_ptr(this_obj);
49220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49222         ReplyChannelRange_free(this_obj_conv);
49223 }
49224
49225 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
49226         LDKReplyChannelRange this_ptr_conv;
49227         this_ptr_conv.inner = untag_ptr(this_ptr);
49228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49230         this_ptr_conv.is_owned = false;
49231         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49232         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
49233         return ret_arr;
49234 }
49235
49236 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49237         LDKReplyChannelRange this_ptr_conv;
49238         this_ptr_conv.inner = untag_ptr(this_ptr);
49239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49241         this_ptr_conv.is_owned = false;
49242         LDKThirtyTwoBytes val_ref;
49243         CHECK(val->arr_len == 32);
49244         memcpy(val_ref.data, val->elems, 32); FREE(val);
49245         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49246 }
49247
49248 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
49249         LDKReplyChannelRange this_ptr_conv;
49250         this_ptr_conv.inner = untag_ptr(this_ptr);
49251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49253         this_ptr_conv.is_owned = false;
49254         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49255         return ret_conv;
49256 }
49257
49258 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
49259         LDKReplyChannelRange this_ptr_conv;
49260         this_ptr_conv.inner = untag_ptr(this_ptr);
49261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49263         this_ptr_conv.is_owned = false;
49264         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49265 }
49266
49267 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
49268         LDKReplyChannelRange this_ptr_conv;
49269         this_ptr_conv.inner = untag_ptr(this_ptr);
49270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49272         this_ptr_conv.is_owned = false;
49273         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49274         return ret_conv;
49275 }
49276
49277 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
49278         LDKReplyChannelRange this_ptr_conv;
49279         this_ptr_conv.inner = untag_ptr(this_ptr);
49280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49282         this_ptr_conv.is_owned = false;
49283         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49284 }
49285
49286 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
49287         LDKReplyChannelRange this_ptr_conv;
49288         this_ptr_conv.inner = untag_ptr(this_ptr);
49289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49291         this_ptr_conv.is_owned = false;
49292         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49293         return ret_conv;
49294 }
49295
49296 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
49297         LDKReplyChannelRange this_ptr_conv;
49298         this_ptr_conv.inner = untag_ptr(this_ptr);
49299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49301         this_ptr_conv.is_owned = false;
49302         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49303 }
49304
49305 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
49306         LDKReplyChannelRange this_ptr_conv;
49307         this_ptr_conv.inner = untag_ptr(this_ptr);
49308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49310         this_ptr_conv.is_owned = false;
49311         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49312         int64_tArray ret_arr = NULL;
49313         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49314         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49315         for (size_t i = 0; i < ret_var.datalen; i++) {
49316                 int64_t ret_conv_8_conv = ret_var.data[i];
49317                 ret_arr_ptr[i] = ret_conv_8_conv;
49318         }
49319         
49320         FREE(ret_var.data);
49321         return ret_arr;
49322 }
49323
49324 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
49325         LDKReplyChannelRange this_ptr_conv;
49326         this_ptr_conv.inner = untag_ptr(this_ptr);
49327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49329         this_ptr_conv.is_owned = false;
49330         LDKCVec_u64Z val_constr;
49331         val_constr.datalen = val->arr_len;
49332         if (val_constr.datalen > 0)
49333                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49334         else
49335                 val_constr.data = NULL;
49336         int64_t* val_vals = val->elems;
49337         for (size_t i = 0; i < val_constr.datalen; i++) {
49338                 int64_t val_conv_8 = val_vals[i];
49339                 val_constr.data[i] = val_conv_8;
49340         }
49341         FREE(val);
49342         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49343 }
49344
49345 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) {
49346         LDKThirtyTwoBytes chain_hash_arg_ref;
49347         CHECK(chain_hash_arg->arr_len == 32);
49348         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49349         LDKCVec_u64Z short_channel_ids_arg_constr;
49350         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49351         if (short_channel_ids_arg_constr.datalen > 0)
49352                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49353         else
49354                 short_channel_ids_arg_constr.data = NULL;
49355         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49356         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
49357                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
49358                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
49359         }
49360         FREE(short_channel_ids_arg);
49361         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
49362         uint64_t ret_ref = 0;
49363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49365         return ret_ref;
49366 }
49367
49368 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
49369         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
49370         uint64_t ret_ref = 0;
49371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49373         return ret_ref;
49374 }
49375 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
49376         LDKReplyChannelRange arg_conv;
49377         arg_conv.inner = untag_ptr(arg);
49378         arg_conv.is_owned = ptr_is_owned(arg);
49379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49380         arg_conv.is_owned = false;
49381         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
49382         return ret_conv;
49383 }
49384
49385 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
49386         LDKReplyChannelRange orig_conv;
49387         orig_conv.inner = untag_ptr(orig);
49388         orig_conv.is_owned = ptr_is_owned(orig);
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49390         orig_conv.is_owned = false;
49391         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
49392         uint64_t ret_ref = 0;
49393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49395         return ret_ref;
49396 }
49397
49398 int64_t  __attribute__((export_name("TS_ReplyChannelRange_hash"))) TS_ReplyChannelRange_hash(uint64_t o) {
49399         LDKReplyChannelRange o_conv;
49400         o_conv.inner = untag_ptr(o);
49401         o_conv.is_owned = ptr_is_owned(o);
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49403         o_conv.is_owned = false;
49404         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
49405         return ret_conv;
49406 }
49407
49408 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
49409         LDKReplyChannelRange a_conv;
49410         a_conv.inner = untag_ptr(a);
49411         a_conv.is_owned = ptr_is_owned(a);
49412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49413         a_conv.is_owned = false;
49414         LDKReplyChannelRange b_conv;
49415         b_conv.inner = untag_ptr(b);
49416         b_conv.is_owned = ptr_is_owned(b);
49417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49418         b_conv.is_owned = false;
49419         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
49420         return ret_conv;
49421 }
49422
49423 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
49424         LDKQueryShortChannelIds this_obj_conv;
49425         this_obj_conv.inner = untag_ptr(this_obj);
49426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49428         QueryShortChannelIds_free(this_obj_conv);
49429 }
49430
49431 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
49432         LDKQueryShortChannelIds this_ptr_conv;
49433         this_ptr_conv.inner = untag_ptr(this_ptr);
49434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49436         this_ptr_conv.is_owned = false;
49437         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49438         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
49439         return ret_arr;
49440 }
49441
49442 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49443         LDKQueryShortChannelIds this_ptr_conv;
49444         this_ptr_conv.inner = untag_ptr(this_ptr);
49445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49447         this_ptr_conv.is_owned = false;
49448         LDKThirtyTwoBytes val_ref;
49449         CHECK(val->arr_len == 32);
49450         memcpy(val_ref.data, val->elems, 32); FREE(val);
49451         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
49452 }
49453
49454 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
49455         LDKQueryShortChannelIds this_ptr_conv;
49456         this_ptr_conv.inner = untag_ptr(this_ptr);
49457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49459         this_ptr_conv.is_owned = false;
49460         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
49461         int64_tArray ret_arr = NULL;
49462         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49463         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49464         for (size_t i = 0; i < ret_var.datalen; i++) {
49465                 int64_t ret_conv_8_conv = ret_var.data[i];
49466                 ret_arr_ptr[i] = ret_conv_8_conv;
49467         }
49468         
49469         FREE(ret_var.data);
49470         return ret_arr;
49471 }
49472
49473 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
49474         LDKQueryShortChannelIds this_ptr_conv;
49475         this_ptr_conv.inner = untag_ptr(this_ptr);
49476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49478         this_ptr_conv.is_owned = false;
49479         LDKCVec_u64Z val_constr;
49480         val_constr.datalen = val->arr_len;
49481         if (val_constr.datalen > 0)
49482                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49483         else
49484                 val_constr.data = NULL;
49485         int64_t* val_vals = val->elems;
49486         for (size_t i = 0; i < val_constr.datalen; i++) {
49487                 int64_t val_conv_8 = val_vals[i];
49488                 val_constr.data[i] = val_conv_8;
49489         }
49490         FREE(val);
49491         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
49492 }
49493
49494 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
49495         LDKThirtyTwoBytes chain_hash_arg_ref;
49496         CHECK(chain_hash_arg->arr_len == 32);
49497         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49498         LDKCVec_u64Z short_channel_ids_arg_constr;
49499         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49500         if (short_channel_ids_arg_constr.datalen > 0)
49501                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49502         else
49503                 short_channel_ids_arg_constr.data = NULL;
49504         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49505         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
49506                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
49507                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
49508         }
49509         FREE(short_channel_ids_arg);
49510         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
49511         uint64_t ret_ref = 0;
49512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49514         return ret_ref;
49515 }
49516
49517 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
49518         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
49519         uint64_t ret_ref = 0;
49520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49522         return ret_ref;
49523 }
49524 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
49525         LDKQueryShortChannelIds arg_conv;
49526         arg_conv.inner = untag_ptr(arg);
49527         arg_conv.is_owned = ptr_is_owned(arg);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49529         arg_conv.is_owned = false;
49530         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
49531         return ret_conv;
49532 }
49533
49534 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
49535         LDKQueryShortChannelIds orig_conv;
49536         orig_conv.inner = untag_ptr(orig);
49537         orig_conv.is_owned = ptr_is_owned(orig);
49538         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49539         orig_conv.is_owned = false;
49540         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
49541         uint64_t ret_ref = 0;
49542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49544         return ret_ref;
49545 }
49546
49547 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_hash"))) TS_QueryShortChannelIds_hash(uint64_t o) {
49548         LDKQueryShortChannelIds o_conv;
49549         o_conv.inner = untag_ptr(o);
49550         o_conv.is_owned = ptr_is_owned(o);
49551         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49552         o_conv.is_owned = false;
49553         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
49554         return ret_conv;
49555 }
49556
49557 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
49558         LDKQueryShortChannelIds a_conv;
49559         a_conv.inner = untag_ptr(a);
49560         a_conv.is_owned = ptr_is_owned(a);
49561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49562         a_conv.is_owned = false;
49563         LDKQueryShortChannelIds b_conv;
49564         b_conv.inner = untag_ptr(b);
49565         b_conv.is_owned = ptr_is_owned(b);
49566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49567         b_conv.is_owned = false;
49568         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
49569         return ret_conv;
49570 }
49571
49572 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
49573         LDKReplyShortChannelIdsEnd this_obj_conv;
49574         this_obj_conv.inner = untag_ptr(this_obj);
49575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49577         ReplyShortChannelIdsEnd_free(this_obj_conv);
49578 }
49579
49580 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
49581         LDKReplyShortChannelIdsEnd this_ptr_conv;
49582         this_ptr_conv.inner = untag_ptr(this_ptr);
49583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49585         this_ptr_conv.is_owned = false;
49586         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49587         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
49588         return ret_arr;
49589 }
49590
49591 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49592         LDKReplyShortChannelIdsEnd this_ptr_conv;
49593         this_ptr_conv.inner = untag_ptr(this_ptr);
49594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49596         this_ptr_conv.is_owned = false;
49597         LDKThirtyTwoBytes val_ref;
49598         CHECK(val->arr_len == 32);
49599         memcpy(val_ref.data, val->elems, 32); FREE(val);
49600         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
49601 }
49602
49603 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
49604         LDKReplyShortChannelIdsEnd this_ptr_conv;
49605         this_ptr_conv.inner = untag_ptr(this_ptr);
49606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49608         this_ptr_conv.is_owned = false;
49609         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
49610         return ret_conv;
49611 }
49612
49613 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
49614         LDKReplyShortChannelIdsEnd this_ptr_conv;
49615         this_ptr_conv.inner = untag_ptr(this_ptr);
49616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49618         this_ptr_conv.is_owned = false;
49619         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
49620 }
49621
49622 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
49623         LDKThirtyTwoBytes chain_hash_arg_ref;
49624         CHECK(chain_hash_arg->arr_len == 32);
49625         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49626         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
49627         uint64_t ret_ref = 0;
49628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49630         return ret_ref;
49631 }
49632
49633 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
49634         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
49635         uint64_t ret_ref = 0;
49636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49638         return ret_ref;
49639 }
49640 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
49641         LDKReplyShortChannelIdsEnd arg_conv;
49642         arg_conv.inner = untag_ptr(arg);
49643         arg_conv.is_owned = ptr_is_owned(arg);
49644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49645         arg_conv.is_owned = false;
49646         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
49647         return ret_conv;
49648 }
49649
49650 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
49651         LDKReplyShortChannelIdsEnd orig_conv;
49652         orig_conv.inner = untag_ptr(orig);
49653         orig_conv.is_owned = ptr_is_owned(orig);
49654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49655         orig_conv.is_owned = false;
49656         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
49657         uint64_t ret_ref = 0;
49658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49660         return ret_ref;
49661 }
49662
49663 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_hash"))) TS_ReplyShortChannelIdsEnd_hash(uint64_t o) {
49664         LDKReplyShortChannelIdsEnd o_conv;
49665         o_conv.inner = untag_ptr(o);
49666         o_conv.is_owned = ptr_is_owned(o);
49667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49668         o_conv.is_owned = false;
49669         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
49670         return ret_conv;
49671 }
49672
49673 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
49674         LDKReplyShortChannelIdsEnd a_conv;
49675         a_conv.inner = untag_ptr(a);
49676         a_conv.is_owned = ptr_is_owned(a);
49677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49678         a_conv.is_owned = false;
49679         LDKReplyShortChannelIdsEnd b_conv;
49680         b_conv.inner = untag_ptr(b);
49681         b_conv.is_owned = ptr_is_owned(b);
49682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49683         b_conv.is_owned = false;
49684         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
49685         return ret_conv;
49686 }
49687
49688 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
49689         LDKGossipTimestampFilter this_obj_conv;
49690         this_obj_conv.inner = untag_ptr(this_obj);
49691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49693         GossipTimestampFilter_free(this_obj_conv);
49694 }
49695
49696 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
49697         LDKGossipTimestampFilter this_ptr_conv;
49698         this_ptr_conv.inner = untag_ptr(this_ptr);
49699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49701         this_ptr_conv.is_owned = false;
49702         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49703         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
49704         return ret_arr;
49705 }
49706
49707 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49708         LDKGossipTimestampFilter this_ptr_conv;
49709         this_ptr_conv.inner = untag_ptr(this_ptr);
49710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49712         this_ptr_conv.is_owned = false;
49713         LDKThirtyTwoBytes val_ref;
49714         CHECK(val->arr_len == 32);
49715         memcpy(val_ref.data, val->elems, 32); FREE(val);
49716         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
49717 }
49718
49719 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
49720         LDKGossipTimestampFilter this_ptr_conv;
49721         this_ptr_conv.inner = untag_ptr(this_ptr);
49722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49724         this_ptr_conv.is_owned = false;
49725         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
49726         return ret_conv;
49727 }
49728
49729 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
49730         LDKGossipTimestampFilter this_ptr_conv;
49731         this_ptr_conv.inner = untag_ptr(this_ptr);
49732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49734         this_ptr_conv.is_owned = false;
49735         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
49736 }
49737
49738 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
49739         LDKGossipTimestampFilter this_ptr_conv;
49740         this_ptr_conv.inner = untag_ptr(this_ptr);
49741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49743         this_ptr_conv.is_owned = false;
49744         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
49745         return ret_conv;
49746 }
49747
49748 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
49749         LDKGossipTimestampFilter this_ptr_conv;
49750         this_ptr_conv.inner = untag_ptr(this_ptr);
49751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49753         this_ptr_conv.is_owned = false;
49754         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
49755 }
49756
49757 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) {
49758         LDKThirtyTwoBytes chain_hash_arg_ref;
49759         CHECK(chain_hash_arg->arr_len == 32);
49760         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49761         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
49762         uint64_t ret_ref = 0;
49763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49765         return ret_ref;
49766 }
49767
49768 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
49769         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
49770         uint64_t ret_ref = 0;
49771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49773         return ret_ref;
49774 }
49775 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
49776         LDKGossipTimestampFilter arg_conv;
49777         arg_conv.inner = untag_ptr(arg);
49778         arg_conv.is_owned = ptr_is_owned(arg);
49779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49780         arg_conv.is_owned = false;
49781         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
49782         return ret_conv;
49783 }
49784
49785 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
49786         LDKGossipTimestampFilter orig_conv;
49787         orig_conv.inner = untag_ptr(orig);
49788         orig_conv.is_owned = ptr_is_owned(orig);
49789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49790         orig_conv.is_owned = false;
49791         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
49792         uint64_t ret_ref = 0;
49793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49795         return ret_ref;
49796 }
49797
49798 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_hash"))) TS_GossipTimestampFilter_hash(uint64_t o) {
49799         LDKGossipTimestampFilter o_conv;
49800         o_conv.inner = untag_ptr(o);
49801         o_conv.is_owned = ptr_is_owned(o);
49802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49803         o_conv.is_owned = false;
49804         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
49805         return ret_conv;
49806 }
49807
49808 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
49809         LDKGossipTimestampFilter a_conv;
49810         a_conv.inner = untag_ptr(a);
49811         a_conv.is_owned = ptr_is_owned(a);
49812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49813         a_conv.is_owned = false;
49814         LDKGossipTimestampFilter b_conv;
49815         b_conv.inner = untag_ptr(b);
49816         b_conv.is_owned = ptr_is_owned(b);
49817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49818         b_conv.is_owned = false;
49819         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
49820         return ret_conv;
49821 }
49822
49823 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
49824         if (!ptr_is_owned(this_ptr)) return;
49825         void* this_ptr_ptr = untag_ptr(this_ptr);
49826         CHECK_ACCESS(this_ptr_ptr);
49827         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
49828         FREE(untag_ptr(this_ptr));
49829         ErrorAction_free(this_ptr_conv);
49830 }
49831
49832 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
49833         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49834         *ret_copy = ErrorAction_clone(arg);
49835         uint64_t ret_ref = tag_ptr(ret_copy, true);
49836         return ret_ref;
49837 }
49838 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
49839         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
49840         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
49841         return ret_conv;
49842 }
49843
49844 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
49845         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
49846         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49847         *ret_copy = ErrorAction_clone(orig_conv);
49848         uint64_t ret_ref = tag_ptr(ret_copy, true);
49849         return ret_ref;
49850 }
49851
49852 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
49853         LDKErrorMessage msg_conv;
49854         msg_conv.inner = untag_ptr(msg);
49855         msg_conv.is_owned = ptr_is_owned(msg);
49856         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49857         msg_conv = ErrorMessage_clone(&msg_conv);
49858         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49859         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
49860         uint64_t ret_ref = tag_ptr(ret_copy, true);
49861         return ret_ref;
49862 }
49863
49864 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
49865         LDKWarningMessage msg_conv;
49866         msg_conv.inner = untag_ptr(msg);
49867         msg_conv.is_owned = ptr_is_owned(msg);
49868         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49869         msg_conv = WarningMessage_clone(&msg_conv);
49870         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49871         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
49872         uint64_t ret_ref = tag_ptr(ret_copy, true);
49873         return ret_ref;
49874 }
49875
49876 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
49877         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49878         *ret_copy = ErrorAction_ignore_error();
49879         uint64_t ret_ref = tag_ptr(ret_copy, true);
49880         return ret_ref;
49881 }
49882
49883 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
49884         LDKLevel a_conv = LDKLevel_from_js(a);
49885         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49886         *ret_copy = ErrorAction_ignore_and_log(a_conv);
49887         uint64_t ret_ref = tag_ptr(ret_copy, true);
49888         return ret_ref;
49889 }
49890
49891 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
49892         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49893         *ret_copy = ErrorAction_ignore_duplicate_gossip();
49894         uint64_t ret_ref = tag_ptr(ret_copy, true);
49895         return ret_ref;
49896 }
49897
49898 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
49899         LDKErrorMessage msg_conv;
49900         msg_conv.inner = untag_ptr(msg);
49901         msg_conv.is_owned = ptr_is_owned(msg);
49902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49903         msg_conv = ErrorMessage_clone(&msg_conv);
49904         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49905         *ret_copy = ErrorAction_send_error_message(msg_conv);
49906         uint64_t ret_ref = tag_ptr(ret_copy, true);
49907         return ret_ref;
49908 }
49909
49910 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
49911         LDKWarningMessage msg_conv;
49912         msg_conv.inner = untag_ptr(msg);
49913         msg_conv.is_owned = ptr_is_owned(msg);
49914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49915         msg_conv = WarningMessage_clone(&msg_conv);
49916         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
49917         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49918         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
49919         uint64_t ret_ref = tag_ptr(ret_copy, true);
49920         return ret_ref;
49921 }
49922
49923 int64_t  __attribute__((export_name("TS_ErrorAction_hash"))) TS_ErrorAction_hash(uint64_t o) {
49924         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
49925         int64_t ret_conv = ErrorAction_hash(o_conv);
49926         return ret_conv;
49927 }
49928
49929 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
49930         LDKLightningError this_obj_conv;
49931         this_obj_conv.inner = untag_ptr(this_obj);
49932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49934         LightningError_free(this_obj_conv);
49935 }
49936
49937 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
49938         LDKLightningError this_ptr_conv;
49939         this_ptr_conv.inner = untag_ptr(this_ptr);
49940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49942         this_ptr_conv.is_owned = false;
49943         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
49944         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49945         Str_free(ret_str);
49946         return ret_conv;
49947 }
49948
49949 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
49950         LDKLightningError this_ptr_conv;
49951         this_ptr_conv.inner = untag_ptr(this_ptr);
49952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49954         this_ptr_conv.is_owned = false;
49955         LDKStr val_conv = str_ref_to_owned_c(val);
49956         LightningError_set_err(&this_ptr_conv, val_conv);
49957 }
49958
49959 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
49960         LDKLightningError this_ptr_conv;
49961         this_ptr_conv.inner = untag_ptr(this_ptr);
49962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49964         this_ptr_conv.is_owned = false;
49965         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49966         *ret_copy = LightningError_get_action(&this_ptr_conv);
49967         uint64_t ret_ref = tag_ptr(ret_copy, true);
49968         return ret_ref;
49969 }
49970
49971 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
49972         LDKLightningError this_ptr_conv;
49973         this_ptr_conv.inner = untag_ptr(this_ptr);
49974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49976         this_ptr_conv.is_owned = false;
49977         void* val_ptr = untag_ptr(val);
49978         CHECK_ACCESS(val_ptr);
49979         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
49980         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
49981         LightningError_set_action(&this_ptr_conv, val_conv);
49982 }
49983
49984 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
49985         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
49986         void* action_arg_ptr = untag_ptr(action_arg);
49987         CHECK_ACCESS(action_arg_ptr);
49988         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
49989         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
49990         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
49991         uint64_t ret_ref = 0;
49992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49994         return ret_ref;
49995 }
49996
49997 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
49998         LDKLightningError ret_var = LightningError_clone(arg);
49999         uint64_t ret_ref = 0;
50000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50002         return ret_ref;
50003 }
50004 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
50005         LDKLightningError arg_conv;
50006         arg_conv.inner = untag_ptr(arg);
50007         arg_conv.is_owned = ptr_is_owned(arg);
50008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50009         arg_conv.is_owned = false;
50010         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
50011         return ret_conv;
50012 }
50013
50014 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
50015         LDKLightningError orig_conv;
50016         orig_conv.inner = untag_ptr(orig);
50017         orig_conv.is_owned = ptr_is_owned(orig);
50018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50019         orig_conv.is_owned = false;
50020         LDKLightningError ret_var = LightningError_clone(&orig_conv);
50021         uint64_t ret_ref = 0;
50022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50024         return ret_ref;
50025 }
50026
50027 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
50028         LDKCommitmentUpdate this_obj_conv;
50029         this_obj_conv.inner = untag_ptr(this_obj);
50030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50032         CommitmentUpdate_free(this_obj_conv);
50033 }
50034
50035 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
50036         LDKCommitmentUpdate this_ptr_conv;
50037         this_ptr_conv.inner = untag_ptr(this_ptr);
50038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50040         this_ptr_conv.is_owned = false;
50041         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
50042         uint64_tArray ret_arr = NULL;
50043         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50044         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50045         for (size_t p = 0; p < ret_var.datalen; p++) {
50046                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50047                 uint64_t ret_conv_15_ref = 0;
50048                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50049                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50050                 ret_arr_ptr[p] = ret_conv_15_ref;
50051         }
50052         
50053         FREE(ret_var.data);
50054         return ret_arr;
50055 }
50056
50057 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
50058         LDKCommitmentUpdate this_ptr_conv;
50059         this_ptr_conv.inner = untag_ptr(this_ptr);
50060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50062         this_ptr_conv.is_owned = false;
50063         LDKCVec_UpdateAddHTLCZ val_constr;
50064         val_constr.datalen = val->arr_len;
50065         if (val_constr.datalen > 0)
50066                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50067         else
50068                 val_constr.data = NULL;
50069         uint64_t* val_vals = val->elems;
50070         for (size_t p = 0; p < val_constr.datalen; p++) {
50071                 uint64_t val_conv_15 = val_vals[p];
50072                 LDKUpdateAddHTLC val_conv_15_conv;
50073                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50074                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50075                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50076                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50077                 val_constr.data[p] = val_conv_15_conv;
50078         }
50079         FREE(val);
50080         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50081 }
50082
50083 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
50084         LDKCommitmentUpdate this_ptr_conv;
50085         this_ptr_conv.inner = untag_ptr(this_ptr);
50086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50088         this_ptr_conv.is_owned = false;
50089         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50090         uint64_tArray ret_arr = NULL;
50091         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50092         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50093         for (size_t t = 0; t < ret_var.datalen; t++) {
50094                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50095                 uint64_t ret_conv_19_ref = 0;
50096                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50097                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50098                 ret_arr_ptr[t] = ret_conv_19_ref;
50099         }
50100         
50101         FREE(ret_var.data);
50102         return ret_arr;
50103 }
50104
50105 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
50106         LDKCommitmentUpdate this_ptr_conv;
50107         this_ptr_conv.inner = untag_ptr(this_ptr);
50108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50110         this_ptr_conv.is_owned = false;
50111         LDKCVec_UpdateFulfillHTLCZ val_constr;
50112         val_constr.datalen = val->arr_len;
50113         if (val_constr.datalen > 0)
50114                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50115         else
50116                 val_constr.data = NULL;
50117         uint64_t* val_vals = val->elems;
50118         for (size_t t = 0; t < val_constr.datalen; t++) {
50119                 uint64_t val_conv_19 = val_vals[t];
50120                 LDKUpdateFulfillHTLC val_conv_19_conv;
50121                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50122                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50123                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50124                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50125                 val_constr.data[t] = val_conv_19_conv;
50126         }
50127         FREE(val);
50128         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50129 }
50130
50131 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
50132         LDKCommitmentUpdate this_ptr_conv;
50133         this_ptr_conv.inner = untag_ptr(this_ptr);
50134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50136         this_ptr_conv.is_owned = false;
50137         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50138         uint64_tArray ret_arr = NULL;
50139         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50140         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50141         for (size_t q = 0; q < ret_var.datalen; q++) {
50142                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50143                 uint64_t ret_conv_16_ref = 0;
50144                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50145                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50146                 ret_arr_ptr[q] = ret_conv_16_ref;
50147         }
50148         
50149         FREE(ret_var.data);
50150         return ret_arr;
50151 }
50152
50153 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
50154         LDKCommitmentUpdate this_ptr_conv;
50155         this_ptr_conv.inner = untag_ptr(this_ptr);
50156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50158         this_ptr_conv.is_owned = false;
50159         LDKCVec_UpdateFailHTLCZ val_constr;
50160         val_constr.datalen = val->arr_len;
50161         if (val_constr.datalen > 0)
50162                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50163         else
50164                 val_constr.data = NULL;
50165         uint64_t* val_vals = val->elems;
50166         for (size_t q = 0; q < val_constr.datalen; q++) {
50167                 uint64_t val_conv_16 = val_vals[q];
50168                 LDKUpdateFailHTLC val_conv_16_conv;
50169                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50170                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50171                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50172                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50173                 val_constr.data[q] = val_conv_16_conv;
50174         }
50175         FREE(val);
50176         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50177 }
50178
50179 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
50180         LDKCommitmentUpdate this_ptr_conv;
50181         this_ptr_conv.inner = untag_ptr(this_ptr);
50182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50184         this_ptr_conv.is_owned = false;
50185         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50186         uint64_tArray ret_arr = NULL;
50187         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50188         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50189         for (size_t z = 0; z < ret_var.datalen; z++) {
50190                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50191                 uint64_t ret_conv_25_ref = 0;
50192                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50193                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50194                 ret_arr_ptr[z] = ret_conv_25_ref;
50195         }
50196         
50197         FREE(ret_var.data);
50198         return ret_arr;
50199 }
50200
50201 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) {
50202         LDKCommitmentUpdate this_ptr_conv;
50203         this_ptr_conv.inner = untag_ptr(this_ptr);
50204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50206         this_ptr_conv.is_owned = false;
50207         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50208         val_constr.datalen = val->arr_len;
50209         if (val_constr.datalen > 0)
50210                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50211         else
50212                 val_constr.data = NULL;
50213         uint64_t* val_vals = val->elems;
50214         for (size_t z = 0; z < val_constr.datalen; z++) {
50215                 uint64_t val_conv_25 = val_vals[z];
50216                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50217                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50218                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50219                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50220                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50221                 val_constr.data[z] = val_conv_25_conv;
50222         }
50223         FREE(val);
50224         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50225 }
50226
50227 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
50228         LDKCommitmentUpdate this_ptr_conv;
50229         this_ptr_conv.inner = untag_ptr(this_ptr);
50230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50232         this_ptr_conv.is_owned = false;
50233         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50234         uint64_t ret_ref = 0;
50235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50237         return ret_ref;
50238 }
50239
50240 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
50241         LDKCommitmentUpdate this_ptr_conv;
50242         this_ptr_conv.inner = untag_ptr(this_ptr);
50243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50245         this_ptr_conv.is_owned = false;
50246         LDKUpdateFee val_conv;
50247         val_conv.inner = untag_ptr(val);
50248         val_conv.is_owned = ptr_is_owned(val);
50249         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50250         val_conv = UpdateFee_clone(&val_conv);
50251         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50252 }
50253
50254 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
50255         LDKCommitmentUpdate this_ptr_conv;
50256         this_ptr_conv.inner = untag_ptr(this_ptr);
50257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50259         this_ptr_conv.is_owned = false;
50260         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50261         uint64_t ret_ref = 0;
50262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50264         return ret_ref;
50265 }
50266
50267 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
50268         LDKCommitmentUpdate this_ptr_conv;
50269         this_ptr_conv.inner = untag_ptr(this_ptr);
50270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50272         this_ptr_conv.is_owned = false;
50273         LDKCommitmentSigned val_conv;
50274         val_conv.inner = untag_ptr(val);
50275         val_conv.is_owned = ptr_is_owned(val);
50276         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50277         val_conv = CommitmentSigned_clone(&val_conv);
50278         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50279 }
50280
50281 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) {
50282         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50283         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
50284         if (update_add_htlcs_arg_constr.datalen > 0)
50285                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50286         else
50287                 update_add_htlcs_arg_constr.data = NULL;
50288         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
50289         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50290                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50291                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50292                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50293                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50294                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50295                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50296                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50297         }
50298         FREE(update_add_htlcs_arg);
50299         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50300         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
50301         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50302                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50303         else
50304                 update_fulfill_htlcs_arg_constr.data = NULL;
50305         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
50306         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50307                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50308                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50309                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50310                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50311                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50312                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50313                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50314         }
50315         FREE(update_fulfill_htlcs_arg);
50316         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50317         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
50318         if (update_fail_htlcs_arg_constr.datalen > 0)
50319                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50320         else
50321                 update_fail_htlcs_arg_constr.data = NULL;
50322         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
50323         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50324                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50325                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50326                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50327                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50328                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50329                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50330                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50331         }
50332         FREE(update_fail_htlcs_arg);
50333         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50334         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
50335         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50336                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50337         else
50338                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50339         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
50340         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50341                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50342                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50343                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50344                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50345                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50346                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50347                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50348         }
50349         FREE(update_fail_malformed_htlcs_arg);
50350         LDKUpdateFee update_fee_arg_conv;
50351         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50352         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50353         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50354         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50355         LDKCommitmentSigned commitment_signed_arg_conv;
50356         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50357         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50358         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50359         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50360         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);
50361         uint64_t ret_ref = 0;
50362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50364         return ret_ref;
50365 }
50366
50367 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50368         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50369         uint64_t ret_ref = 0;
50370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50372         return ret_ref;
50373 }
50374 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
50375         LDKCommitmentUpdate arg_conv;
50376         arg_conv.inner = untag_ptr(arg);
50377         arg_conv.is_owned = ptr_is_owned(arg);
50378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50379         arg_conv.is_owned = false;
50380         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50381         return ret_conv;
50382 }
50383
50384 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
50385         LDKCommitmentUpdate orig_conv;
50386         orig_conv.inner = untag_ptr(orig);
50387         orig_conv.is_owned = ptr_is_owned(orig);
50388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50389         orig_conv.is_owned = false;
50390         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50391         uint64_t ret_ref = 0;
50392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50394         return ret_ref;
50395 }
50396
50397 int64_t  __attribute__((export_name("TS_CommitmentUpdate_hash"))) TS_CommitmentUpdate_hash(uint64_t o) {
50398         LDKCommitmentUpdate o_conv;
50399         o_conv.inner = untag_ptr(o);
50400         o_conv.is_owned = ptr_is_owned(o);
50401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50402         o_conv.is_owned = false;
50403         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
50404         return ret_conv;
50405 }
50406
50407 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
50408         LDKCommitmentUpdate a_conv;
50409         a_conv.inner = untag_ptr(a);
50410         a_conv.is_owned = ptr_is_owned(a);
50411         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50412         a_conv.is_owned = false;
50413         LDKCommitmentUpdate b_conv;
50414         b_conv.inner = untag_ptr(b);
50415         b_conv.is_owned = ptr_is_owned(b);
50416         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50417         b_conv.is_owned = false;
50418         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
50419         return ret_conv;
50420 }
50421
50422 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
50423         if (!ptr_is_owned(this_ptr)) return;
50424         void* this_ptr_ptr = untag_ptr(this_ptr);
50425         CHECK_ACCESS(this_ptr_ptr);
50426         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
50427         FREE(untag_ptr(this_ptr));
50428         ChannelMessageHandler_free(this_ptr_conv);
50429 }
50430
50431 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
50432         if (!ptr_is_owned(this_ptr)) return;
50433         void* this_ptr_ptr = untag_ptr(this_ptr);
50434         CHECK_ACCESS(this_ptr_ptr);
50435         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
50436         FREE(untag_ptr(this_ptr));
50437         RoutingMessageHandler_free(this_ptr_conv);
50438 }
50439
50440 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
50441         if (!ptr_is_owned(this_ptr)) return;
50442         void* this_ptr_ptr = untag_ptr(this_ptr);
50443         CHECK_ACCESS(this_ptr_ptr);
50444         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
50445         FREE(untag_ptr(this_ptr));
50446         OnionMessageHandler_free(this_ptr_conv);
50447 }
50448
50449 void  __attribute__((export_name("TS_FinalOnionHopData_free"))) TS_FinalOnionHopData_free(uint64_t this_obj) {
50450         LDKFinalOnionHopData this_obj_conv;
50451         this_obj_conv.inner = untag_ptr(this_obj);
50452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50454         FinalOnionHopData_free(this_obj_conv);
50455 }
50456
50457 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_get_payment_secret"))) TS_FinalOnionHopData_get_payment_secret(uint64_t this_ptr) {
50458         LDKFinalOnionHopData this_ptr_conv;
50459         this_ptr_conv.inner = untag_ptr(this_ptr);
50460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50462         this_ptr_conv.is_owned = false;
50463         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50464         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
50465         return ret_arr;
50466 }
50467
50468 void  __attribute__((export_name("TS_FinalOnionHopData_set_payment_secret"))) TS_FinalOnionHopData_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
50469         LDKFinalOnionHopData this_ptr_conv;
50470         this_ptr_conv.inner = untag_ptr(this_ptr);
50471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50473         this_ptr_conv.is_owned = false;
50474         LDKThirtyTwoBytes val_ref;
50475         CHECK(val->arr_len == 32);
50476         memcpy(val_ref.data, val->elems, 32); FREE(val);
50477         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
50478 }
50479
50480 int64_t  __attribute__((export_name("TS_FinalOnionHopData_get_total_msat"))) TS_FinalOnionHopData_get_total_msat(uint64_t this_ptr) {
50481         LDKFinalOnionHopData this_ptr_conv;
50482         this_ptr_conv.inner = untag_ptr(this_ptr);
50483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50485         this_ptr_conv.is_owned = false;
50486         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
50487         return ret_conv;
50488 }
50489
50490 void  __attribute__((export_name("TS_FinalOnionHopData_set_total_msat"))) TS_FinalOnionHopData_set_total_msat(uint64_t this_ptr, int64_t val) {
50491         LDKFinalOnionHopData this_ptr_conv;
50492         this_ptr_conv.inner = untag_ptr(this_ptr);
50493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50495         this_ptr_conv.is_owned = false;
50496         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
50497 }
50498
50499 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_new"))) TS_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
50500         LDKThirtyTwoBytes payment_secret_arg_ref;
50501         CHECK(payment_secret_arg->arr_len == 32);
50502         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
50503         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
50504         uint64_t ret_ref = 0;
50505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50507         return ret_ref;
50508 }
50509
50510 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
50511         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
50512         uint64_t ret_ref = 0;
50513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50515         return ret_ref;
50516 }
50517 int64_t  __attribute__((export_name("TS_FinalOnionHopData_clone_ptr"))) TS_FinalOnionHopData_clone_ptr(uint64_t arg) {
50518         LDKFinalOnionHopData arg_conv;
50519         arg_conv.inner = untag_ptr(arg);
50520         arg_conv.is_owned = ptr_is_owned(arg);
50521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50522         arg_conv.is_owned = false;
50523         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
50524         return ret_conv;
50525 }
50526
50527 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_clone"))) TS_FinalOnionHopData_clone(uint64_t orig) {
50528         LDKFinalOnionHopData orig_conv;
50529         orig_conv.inner = untag_ptr(orig);
50530         orig_conv.is_owned = ptr_is_owned(orig);
50531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50532         orig_conv.is_owned = false;
50533         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
50534         uint64_t ret_ref = 0;
50535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50537         return ret_ref;
50538 }
50539
50540 void  __attribute__((export_name("TS_OnionPacket_free"))) TS_OnionPacket_free(uint64_t this_obj) {
50541         LDKOnionPacket this_obj_conv;
50542         this_obj_conv.inner = untag_ptr(this_obj);
50543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50545         OnionPacket_free(this_obj_conv);
50546 }
50547
50548 int8_t  __attribute__((export_name("TS_OnionPacket_get_version"))) TS_OnionPacket_get_version(uint64_t this_ptr) {
50549         LDKOnionPacket this_ptr_conv;
50550         this_ptr_conv.inner = untag_ptr(this_ptr);
50551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50553         this_ptr_conv.is_owned = false;
50554         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
50555         return ret_conv;
50556 }
50557
50558 void  __attribute__((export_name("TS_OnionPacket_set_version"))) TS_OnionPacket_set_version(uint64_t this_ptr, int8_t val) {
50559         LDKOnionPacket this_ptr_conv;
50560         this_ptr_conv.inner = untag_ptr(this_ptr);
50561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50563         this_ptr_conv.is_owned = false;
50564         OnionPacket_set_version(&this_ptr_conv, val);
50565 }
50566
50567 uint64_t  __attribute__((export_name("TS_OnionPacket_get_public_key"))) TS_OnionPacket_get_public_key(uint64_t this_ptr) {
50568         LDKOnionPacket this_ptr_conv;
50569         this_ptr_conv.inner = untag_ptr(this_ptr);
50570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50572         this_ptr_conv.is_owned = false;
50573         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
50574         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
50575         return tag_ptr(ret_conv, true);
50576 }
50577
50578 void  __attribute__((export_name("TS_OnionPacket_set_public_key"))) TS_OnionPacket_set_public_key(uint64_t this_ptr, uint64_t val) {
50579         LDKOnionPacket this_ptr_conv;
50580         this_ptr_conv.inner = untag_ptr(this_ptr);
50581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50583         this_ptr_conv.is_owned = false;
50584         void* val_ptr = untag_ptr(val);
50585         CHECK_ACCESS(val_ptr);
50586         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
50587         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
50588         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
50589 }
50590
50591 int8_tArray  __attribute__((export_name("TS_OnionPacket_get_hmac"))) TS_OnionPacket_get_hmac(uint64_t this_ptr) {
50592         LDKOnionPacket this_ptr_conv;
50593         this_ptr_conv.inner = untag_ptr(this_ptr);
50594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50596         this_ptr_conv.is_owned = false;
50597         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50598         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
50599         return ret_arr;
50600 }
50601
50602 void  __attribute__((export_name("TS_OnionPacket_set_hmac"))) TS_OnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
50603         LDKOnionPacket this_ptr_conv;
50604         this_ptr_conv.inner = untag_ptr(this_ptr);
50605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50607         this_ptr_conv.is_owned = false;
50608         LDKThirtyTwoBytes val_ref;
50609         CHECK(val->arr_len == 32);
50610         memcpy(val_ref.data, val->elems, 32); FREE(val);
50611         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
50612 }
50613
50614 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
50615         LDKOnionPacket ret_var = OnionPacket_clone(arg);
50616         uint64_t ret_ref = 0;
50617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50619         return ret_ref;
50620 }
50621 int64_t  __attribute__((export_name("TS_OnionPacket_clone_ptr"))) TS_OnionPacket_clone_ptr(uint64_t arg) {
50622         LDKOnionPacket arg_conv;
50623         arg_conv.inner = untag_ptr(arg);
50624         arg_conv.is_owned = ptr_is_owned(arg);
50625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50626         arg_conv.is_owned = false;
50627         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
50628         return ret_conv;
50629 }
50630
50631 uint64_t  __attribute__((export_name("TS_OnionPacket_clone"))) TS_OnionPacket_clone(uint64_t orig) {
50632         LDKOnionPacket orig_conv;
50633         orig_conv.inner = untag_ptr(orig);
50634         orig_conv.is_owned = ptr_is_owned(orig);
50635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50636         orig_conv.is_owned = false;
50637         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
50638         uint64_t ret_ref = 0;
50639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50641         return ret_ref;
50642 }
50643
50644 int64_t  __attribute__((export_name("TS_OnionPacket_hash"))) TS_OnionPacket_hash(uint64_t o) {
50645         LDKOnionPacket o_conv;
50646         o_conv.inner = untag_ptr(o);
50647         o_conv.is_owned = ptr_is_owned(o);
50648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50649         o_conv.is_owned = false;
50650         int64_t ret_conv = OnionPacket_hash(&o_conv);
50651         return ret_conv;
50652 }
50653
50654 jboolean  __attribute__((export_name("TS_OnionPacket_eq"))) TS_OnionPacket_eq(uint64_t a, uint64_t b) {
50655         LDKOnionPacket a_conv;
50656         a_conv.inner = untag_ptr(a);
50657         a_conv.is_owned = ptr_is_owned(a);
50658         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50659         a_conv.is_owned = false;
50660         LDKOnionPacket b_conv;
50661         b_conv.inner = untag_ptr(b);
50662         b_conv.is_owned = ptr_is_owned(b);
50663         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50664         b_conv.is_owned = false;
50665         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
50666         return ret_conv;
50667 }
50668
50669 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
50670         LDKAcceptChannel obj_conv;
50671         obj_conv.inner = untag_ptr(obj);
50672         obj_conv.is_owned = ptr_is_owned(obj);
50673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50674         obj_conv.is_owned = false;
50675         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
50676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50678         CVec_u8Z_free(ret_var);
50679         return ret_arr;
50680 }
50681
50682 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
50683         LDKu8slice ser_ref;
50684         ser_ref.datalen = ser->arr_len;
50685         ser_ref.data = ser->elems;
50686         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
50687         *ret_conv = AcceptChannel_read(ser_ref);
50688         FREE(ser);
50689         return tag_ptr(ret_conv, true);
50690 }
50691
50692 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
50693         LDKAcceptChannelV2 obj_conv;
50694         obj_conv.inner = untag_ptr(obj);
50695         obj_conv.is_owned = ptr_is_owned(obj);
50696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50697         obj_conv.is_owned = false;
50698         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
50699         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50700         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50701         CVec_u8Z_free(ret_var);
50702         return ret_arr;
50703 }
50704
50705 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
50706         LDKu8slice ser_ref;
50707         ser_ref.datalen = ser->arr_len;
50708         ser_ref.data = ser->elems;
50709         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
50710         *ret_conv = AcceptChannelV2_read(ser_ref);
50711         FREE(ser);
50712         return tag_ptr(ret_conv, true);
50713 }
50714
50715 int8_tArray  __attribute__((export_name("TS_Stfu_write"))) TS_Stfu_write(uint64_t obj) {
50716         LDKStfu obj_conv;
50717         obj_conv.inner = untag_ptr(obj);
50718         obj_conv.is_owned = ptr_is_owned(obj);
50719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50720         obj_conv.is_owned = false;
50721         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
50722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50724         CVec_u8Z_free(ret_var);
50725         return ret_arr;
50726 }
50727
50728 uint64_t  __attribute__((export_name("TS_Stfu_read"))) TS_Stfu_read(int8_tArray ser) {
50729         LDKu8slice ser_ref;
50730         ser_ref.datalen = ser->arr_len;
50731         ser_ref.data = ser->elems;
50732         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
50733         *ret_conv = Stfu_read(ser_ref);
50734         FREE(ser);
50735         return tag_ptr(ret_conv, true);
50736 }
50737
50738 int8_tArray  __attribute__((export_name("TS_Splice_write"))) TS_Splice_write(uint64_t obj) {
50739         LDKSplice obj_conv;
50740         obj_conv.inner = untag_ptr(obj);
50741         obj_conv.is_owned = ptr_is_owned(obj);
50742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50743         obj_conv.is_owned = false;
50744         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
50745         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50746         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50747         CVec_u8Z_free(ret_var);
50748         return ret_arr;
50749 }
50750
50751 uint64_t  __attribute__((export_name("TS_Splice_read"))) TS_Splice_read(int8_tArray ser) {
50752         LDKu8slice ser_ref;
50753         ser_ref.datalen = ser->arr_len;
50754         ser_ref.data = ser->elems;
50755         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
50756         *ret_conv = Splice_read(ser_ref);
50757         FREE(ser);
50758         return tag_ptr(ret_conv, true);
50759 }
50760
50761 int8_tArray  __attribute__((export_name("TS_SpliceAck_write"))) TS_SpliceAck_write(uint64_t obj) {
50762         LDKSpliceAck obj_conv;
50763         obj_conv.inner = untag_ptr(obj);
50764         obj_conv.is_owned = ptr_is_owned(obj);
50765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50766         obj_conv.is_owned = false;
50767         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
50768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50770         CVec_u8Z_free(ret_var);
50771         return ret_arr;
50772 }
50773
50774 uint64_t  __attribute__((export_name("TS_SpliceAck_read"))) TS_SpliceAck_read(int8_tArray ser) {
50775         LDKu8slice ser_ref;
50776         ser_ref.datalen = ser->arr_len;
50777         ser_ref.data = ser->elems;
50778         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
50779         *ret_conv = SpliceAck_read(ser_ref);
50780         FREE(ser);
50781         return tag_ptr(ret_conv, true);
50782 }
50783
50784 int8_tArray  __attribute__((export_name("TS_SpliceLocked_write"))) TS_SpliceLocked_write(uint64_t obj) {
50785         LDKSpliceLocked obj_conv;
50786         obj_conv.inner = untag_ptr(obj);
50787         obj_conv.is_owned = ptr_is_owned(obj);
50788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50789         obj_conv.is_owned = false;
50790         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
50791         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50792         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50793         CVec_u8Z_free(ret_var);
50794         return ret_arr;
50795 }
50796
50797 uint64_t  __attribute__((export_name("TS_SpliceLocked_read"))) TS_SpliceLocked_read(int8_tArray ser) {
50798         LDKu8slice ser_ref;
50799         ser_ref.datalen = ser->arr_len;
50800         ser_ref.data = ser->elems;
50801         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
50802         *ret_conv = SpliceLocked_read(ser_ref);
50803         FREE(ser);
50804         return tag_ptr(ret_conv, true);
50805 }
50806
50807 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
50808         LDKTxAddInput obj_conv;
50809         obj_conv.inner = untag_ptr(obj);
50810         obj_conv.is_owned = ptr_is_owned(obj);
50811         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50812         obj_conv.is_owned = false;
50813         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
50814         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50815         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50816         CVec_u8Z_free(ret_var);
50817         return ret_arr;
50818 }
50819
50820 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
50821         LDKu8slice ser_ref;
50822         ser_ref.datalen = ser->arr_len;
50823         ser_ref.data = ser->elems;
50824         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
50825         *ret_conv = TxAddInput_read(ser_ref);
50826         FREE(ser);
50827         return tag_ptr(ret_conv, true);
50828 }
50829
50830 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
50831         LDKTxAddOutput obj_conv;
50832         obj_conv.inner = untag_ptr(obj);
50833         obj_conv.is_owned = ptr_is_owned(obj);
50834         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50835         obj_conv.is_owned = false;
50836         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
50837         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50838         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50839         CVec_u8Z_free(ret_var);
50840         return ret_arr;
50841 }
50842
50843 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
50844         LDKu8slice ser_ref;
50845         ser_ref.datalen = ser->arr_len;
50846         ser_ref.data = ser->elems;
50847         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
50848         *ret_conv = TxAddOutput_read(ser_ref);
50849         FREE(ser);
50850         return tag_ptr(ret_conv, true);
50851 }
50852
50853 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
50854         LDKTxRemoveInput obj_conv;
50855         obj_conv.inner = untag_ptr(obj);
50856         obj_conv.is_owned = ptr_is_owned(obj);
50857         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50858         obj_conv.is_owned = false;
50859         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
50860         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50861         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50862         CVec_u8Z_free(ret_var);
50863         return ret_arr;
50864 }
50865
50866 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
50867         LDKu8slice ser_ref;
50868         ser_ref.datalen = ser->arr_len;
50869         ser_ref.data = ser->elems;
50870         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
50871         *ret_conv = TxRemoveInput_read(ser_ref);
50872         FREE(ser);
50873         return tag_ptr(ret_conv, true);
50874 }
50875
50876 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
50877         LDKTxRemoveOutput obj_conv;
50878         obj_conv.inner = untag_ptr(obj);
50879         obj_conv.is_owned = ptr_is_owned(obj);
50880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50881         obj_conv.is_owned = false;
50882         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
50883         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50884         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50885         CVec_u8Z_free(ret_var);
50886         return ret_arr;
50887 }
50888
50889 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
50890         LDKu8slice ser_ref;
50891         ser_ref.datalen = ser->arr_len;
50892         ser_ref.data = ser->elems;
50893         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
50894         *ret_conv = TxRemoveOutput_read(ser_ref);
50895         FREE(ser);
50896         return tag_ptr(ret_conv, true);
50897 }
50898
50899 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
50900         LDKTxComplete obj_conv;
50901         obj_conv.inner = untag_ptr(obj);
50902         obj_conv.is_owned = ptr_is_owned(obj);
50903         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50904         obj_conv.is_owned = false;
50905         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
50906         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50907         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50908         CVec_u8Z_free(ret_var);
50909         return ret_arr;
50910 }
50911
50912 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
50913         LDKu8slice ser_ref;
50914         ser_ref.datalen = ser->arr_len;
50915         ser_ref.data = ser->elems;
50916         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
50917         *ret_conv = TxComplete_read(ser_ref);
50918         FREE(ser);
50919         return tag_ptr(ret_conv, true);
50920 }
50921
50922 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
50923         LDKTxSignatures obj_conv;
50924         obj_conv.inner = untag_ptr(obj);
50925         obj_conv.is_owned = ptr_is_owned(obj);
50926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50927         obj_conv.is_owned = false;
50928         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
50929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50931         CVec_u8Z_free(ret_var);
50932         return ret_arr;
50933 }
50934
50935 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
50936         LDKu8slice ser_ref;
50937         ser_ref.datalen = ser->arr_len;
50938         ser_ref.data = ser->elems;
50939         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
50940         *ret_conv = TxSignatures_read(ser_ref);
50941         FREE(ser);
50942         return tag_ptr(ret_conv, true);
50943 }
50944
50945 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
50946         LDKTxInitRbf obj_conv;
50947         obj_conv.inner = untag_ptr(obj);
50948         obj_conv.is_owned = ptr_is_owned(obj);
50949         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50950         obj_conv.is_owned = false;
50951         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
50952         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50953         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50954         CVec_u8Z_free(ret_var);
50955         return ret_arr;
50956 }
50957
50958 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
50959         LDKu8slice ser_ref;
50960         ser_ref.datalen = ser->arr_len;
50961         ser_ref.data = ser->elems;
50962         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
50963         *ret_conv = TxInitRbf_read(ser_ref);
50964         FREE(ser);
50965         return tag_ptr(ret_conv, true);
50966 }
50967
50968 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
50969         LDKTxAckRbf obj_conv;
50970         obj_conv.inner = untag_ptr(obj);
50971         obj_conv.is_owned = ptr_is_owned(obj);
50972         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50973         obj_conv.is_owned = false;
50974         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
50975         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50976         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50977         CVec_u8Z_free(ret_var);
50978         return ret_arr;
50979 }
50980
50981 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
50982         LDKu8slice ser_ref;
50983         ser_ref.datalen = ser->arr_len;
50984         ser_ref.data = ser->elems;
50985         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
50986         *ret_conv = TxAckRbf_read(ser_ref);
50987         FREE(ser);
50988         return tag_ptr(ret_conv, true);
50989 }
50990
50991 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
50992         LDKTxAbort obj_conv;
50993         obj_conv.inner = untag_ptr(obj);
50994         obj_conv.is_owned = ptr_is_owned(obj);
50995         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50996         obj_conv.is_owned = false;
50997         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
50998         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50999         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51000         CVec_u8Z_free(ret_var);
51001         return ret_arr;
51002 }
51003
51004 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
51005         LDKu8slice ser_ref;
51006         ser_ref.datalen = ser->arr_len;
51007         ser_ref.data = ser->elems;
51008         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
51009         *ret_conv = TxAbort_read(ser_ref);
51010         FREE(ser);
51011         return tag_ptr(ret_conv, true);
51012 }
51013
51014 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
51015         LDKAnnouncementSignatures obj_conv;
51016         obj_conv.inner = untag_ptr(obj);
51017         obj_conv.is_owned = ptr_is_owned(obj);
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51019         obj_conv.is_owned = false;
51020         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
51021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51023         CVec_u8Z_free(ret_var);
51024         return ret_arr;
51025 }
51026
51027 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
51028         LDKu8slice ser_ref;
51029         ser_ref.datalen = ser->arr_len;
51030         ser_ref.data = ser->elems;
51031         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
51032         *ret_conv = AnnouncementSignatures_read(ser_ref);
51033         FREE(ser);
51034         return tag_ptr(ret_conv, true);
51035 }
51036
51037 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
51038         LDKChannelReestablish obj_conv;
51039         obj_conv.inner = untag_ptr(obj);
51040         obj_conv.is_owned = ptr_is_owned(obj);
51041         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51042         obj_conv.is_owned = false;
51043         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
51044         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51045         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51046         CVec_u8Z_free(ret_var);
51047         return ret_arr;
51048 }
51049
51050 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
51051         LDKu8slice ser_ref;
51052         ser_ref.datalen = ser->arr_len;
51053         ser_ref.data = ser->elems;
51054         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
51055         *ret_conv = ChannelReestablish_read(ser_ref);
51056         FREE(ser);
51057         return tag_ptr(ret_conv, true);
51058 }
51059
51060 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
51061         LDKClosingSigned obj_conv;
51062         obj_conv.inner = untag_ptr(obj);
51063         obj_conv.is_owned = ptr_is_owned(obj);
51064         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51065         obj_conv.is_owned = false;
51066         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
51067         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51068         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51069         CVec_u8Z_free(ret_var);
51070         return ret_arr;
51071 }
51072
51073 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
51074         LDKu8slice ser_ref;
51075         ser_ref.datalen = ser->arr_len;
51076         ser_ref.data = ser->elems;
51077         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
51078         *ret_conv = ClosingSigned_read(ser_ref);
51079         FREE(ser);
51080         return tag_ptr(ret_conv, true);
51081 }
51082
51083 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
51084         LDKClosingSignedFeeRange obj_conv;
51085         obj_conv.inner = untag_ptr(obj);
51086         obj_conv.is_owned = ptr_is_owned(obj);
51087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51088         obj_conv.is_owned = false;
51089         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
51090         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51091         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51092         CVec_u8Z_free(ret_var);
51093         return ret_arr;
51094 }
51095
51096 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
51097         LDKu8slice ser_ref;
51098         ser_ref.datalen = ser->arr_len;
51099         ser_ref.data = ser->elems;
51100         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
51101         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
51102         FREE(ser);
51103         return tag_ptr(ret_conv, true);
51104 }
51105
51106 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
51107         LDKCommitmentSigned obj_conv;
51108         obj_conv.inner = untag_ptr(obj);
51109         obj_conv.is_owned = ptr_is_owned(obj);
51110         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51111         obj_conv.is_owned = false;
51112         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
51113         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51114         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51115         CVec_u8Z_free(ret_var);
51116         return ret_arr;
51117 }
51118
51119 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
51120         LDKu8slice ser_ref;
51121         ser_ref.datalen = ser->arr_len;
51122         ser_ref.data = ser->elems;
51123         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
51124         *ret_conv = CommitmentSigned_read(ser_ref);
51125         FREE(ser);
51126         return tag_ptr(ret_conv, true);
51127 }
51128
51129 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
51130         LDKFundingCreated obj_conv;
51131         obj_conv.inner = untag_ptr(obj);
51132         obj_conv.is_owned = ptr_is_owned(obj);
51133         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51134         obj_conv.is_owned = false;
51135         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
51136         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51137         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51138         CVec_u8Z_free(ret_var);
51139         return ret_arr;
51140 }
51141
51142 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
51143         LDKu8slice ser_ref;
51144         ser_ref.datalen = ser->arr_len;
51145         ser_ref.data = ser->elems;
51146         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
51147         *ret_conv = FundingCreated_read(ser_ref);
51148         FREE(ser);
51149         return tag_ptr(ret_conv, true);
51150 }
51151
51152 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
51153         LDKFundingSigned obj_conv;
51154         obj_conv.inner = untag_ptr(obj);
51155         obj_conv.is_owned = ptr_is_owned(obj);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51157         obj_conv.is_owned = false;
51158         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
51159         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51160         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51161         CVec_u8Z_free(ret_var);
51162         return ret_arr;
51163 }
51164
51165 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
51166         LDKu8slice ser_ref;
51167         ser_ref.datalen = ser->arr_len;
51168         ser_ref.data = ser->elems;
51169         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
51170         *ret_conv = FundingSigned_read(ser_ref);
51171         FREE(ser);
51172         return tag_ptr(ret_conv, true);
51173 }
51174
51175 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
51176         LDKChannelReady obj_conv;
51177         obj_conv.inner = untag_ptr(obj);
51178         obj_conv.is_owned = ptr_is_owned(obj);
51179         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51180         obj_conv.is_owned = false;
51181         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
51182         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51183         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51184         CVec_u8Z_free(ret_var);
51185         return ret_arr;
51186 }
51187
51188 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
51189         LDKu8slice ser_ref;
51190         ser_ref.datalen = ser->arr_len;
51191         ser_ref.data = ser->elems;
51192         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
51193         *ret_conv = ChannelReady_read(ser_ref);
51194         FREE(ser);
51195         return tag_ptr(ret_conv, true);
51196 }
51197
51198 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
51199         LDKInit obj_conv;
51200         obj_conv.inner = untag_ptr(obj);
51201         obj_conv.is_owned = ptr_is_owned(obj);
51202         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51203         obj_conv.is_owned = false;
51204         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
51205         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51206         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51207         CVec_u8Z_free(ret_var);
51208         return ret_arr;
51209 }
51210
51211 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
51212         LDKu8slice ser_ref;
51213         ser_ref.datalen = ser->arr_len;
51214         ser_ref.data = ser->elems;
51215         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
51216         *ret_conv = Init_read(ser_ref);
51217         FREE(ser);
51218         return tag_ptr(ret_conv, true);
51219 }
51220
51221 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
51222         LDKOpenChannel obj_conv;
51223         obj_conv.inner = untag_ptr(obj);
51224         obj_conv.is_owned = ptr_is_owned(obj);
51225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51226         obj_conv.is_owned = false;
51227         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
51228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51230         CVec_u8Z_free(ret_var);
51231         return ret_arr;
51232 }
51233
51234 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
51235         LDKu8slice ser_ref;
51236         ser_ref.datalen = ser->arr_len;
51237         ser_ref.data = ser->elems;
51238         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
51239         *ret_conv = OpenChannel_read(ser_ref);
51240         FREE(ser);
51241         return tag_ptr(ret_conv, true);
51242 }
51243
51244 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
51245         LDKOpenChannelV2 obj_conv;
51246         obj_conv.inner = untag_ptr(obj);
51247         obj_conv.is_owned = ptr_is_owned(obj);
51248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51249         obj_conv.is_owned = false;
51250         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
51251         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51252         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51253         CVec_u8Z_free(ret_var);
51254         return ret_arr;
51255 }
51256
51257 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
51258         LDKu8slice ser_ref;
51259         ser_ref.datalen = ser->arr_len;
51260         ser_ref.data = ser->elems;
51261         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
51262         *ret_conv = OpenChannelV2_read(ser_ref);
51263         FREE(ser);
51264         return tag_ptr(ret_conv, true);
51265 }
51266
51267 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
51268         LDKRevokeAndACK obj_conv;
51269         obj_conv.inner = untag_ptr(obj);
51270         obj_conv.is_owned = ptr_is_owned(obj);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51272         obj_conv.is_owned = false;
51273         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
51274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51276         CVec_u8Z_free(ret_var);
51277         return ret_arr;
51278 }
51279
51280 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
51281         LDKu8slice ser_ref;
51282         ser_ref.datalen = ser->arr_len;
51283         ser_ref.data = ser->elems;
51284         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
51285         *ret_conv = RevokeAndACK_read(ser_ref);
51286         FREE(ser);
51287         return tag_ptr(ret_conv, true);
51288 }
51289
51290 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
51291         LDKShutdown obj_conv;
51292         obj_conv.inner = untag_ptr(obj);
51293         obj_conv.is_owned = ptr_is_owned(obj);
51294         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51295         obj_conv.is_owned = false;
51296         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
51297         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51298         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51299         CVec_u8Z_free(ret_var);
51300         return ret_arr;
51301 }
51302
51303 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
51304         LDKu8slice ser_ref;
51305         ser_ref.datalen = ser->arr_len;
51306         ser_ref.data = ser->elems;
51307         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
51308         *ret_conv = Shutdown_read(ser_ref);
51309         FREE(ser);
51310         return tag_ptr(ret_conv, true);
51311 }
51312
51313 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
51314         LDKUpdateFailHTLC obj_conv;
51315         obj_conv.inner = untag_ptr(obj);
51316         obj_conv.is_owned = ptr_is_owned(obj);
51317         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51318         obj_conv.is_owned = false;
51319         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
51320         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51321         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51322         CVec_u8Z_free(ret_var);
51323         return ret_arr;
51324 }
51325
51326 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
51327         LDKu8slice ser_ref;
51328         ser_ref.datalen = ser->arr_len;
51329         ser_ref.data = ser->elems;
51330         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
51331         *ret_conv = UpdateFailHTLC_read(ser_ref);
51332         FREE(ser);
51333         return tag_ptr(ret_conv, true);
51334 }
51335
51336 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
51337         LDKUpdateFailMalformedHTLC obj_conv;
51338         obj_conv.inner = untag_ptr(obj);
51339         obj_conv.is_owned = ptr_is_owned(obj);
51340         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51341         obj_conv.is_owned = false;
51342         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
51343         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51344         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51345         CVec_u8Z_free(ret_var);
51346         return ret_arr;
51347 }
51348
51349 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
51350         LDKu8slice ser_ref;
51351         ser_ref.datalen = ser->arr_len;
51352         ser_ref.data = ser->elems;
51353         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
51354         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
51355         FREE(ser);
51356         return tag_ptr(ret_conv, true);
51357 }
51358
51359 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
51360         LDKUpdateFee obj_conv;
51361         obj_conv.inner = untag_ptr(obj);
51362         obj_conv.is_owned = ptr_is_owned(obj);
51363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51364         obj_conv.is_owned = false;
51365         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
51366         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51367         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51368         CVec_u8Z_free(ret_var);
51369         return ret_arr;
51370 }
51371
51372 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
51373         LDKu8slice ser_ref;
51374         ser_ref.datalen = ser->arr_len;
51375         ser_ref.data = ser->elems;
51376         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51377         *ret_conv = UpdateFee_read(ser_ref);
51378         FREE(ser);
51379         return tag_ptr(ret_conv, true);
51380 }
51381
51382 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
51383         LDKUpdateFulfillHTLC obj_conv;
51384         obj_conv.inner = untag_ptr(obj);
51385         obj_conv.is_owned = ptr_is_owned(obj);
51386         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51387         obj_conv.is_owned = false;
51388         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51389         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51390         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51391         CVec_u8Z_free(ret_var);
51392         return ret_arr;
51393 }
51394
51395 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
51396         LDKu8slice ser_ref;
51397         ser_ref.datalen = ser->arr_len;
51398         ser_ref.data = ser->elems;
51399         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51400         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51401         FREE(ser);
51402         return tag_ptr(ret_conv, true);
51403 }
51404
51405 int8_tArray  __attribute__((export_name("TS_OnionPacket_write"))) TS_OnionPacket_write(uint64_t obj) {
51406         LDKOnionPacket obj_conv;
51407         obj_conv.inner = untag_ptr(obj);
51408         obj_conv.is_owned = ptr_is_owned(obj);
51409         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51410         obj_conv.is_owned = false;
51411         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
51412         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51413         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51414         CVec_u8Z_free(ret_var);
51415         return ret_arr;
51416 }
51417
51418 uint64_t  __attribute__((export_name("TS_OnionPacket_read"))) TS_OnionPacket_read(int8_tArray ser) {
51419         LDKu8slice ser_ref;
51420         ser_ref.datalen = ser->arr_len;
51421         ser_ref.data = ser->elems;
51422         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
51423         *ret_conv = OnionPacket_read(ser_ref);
51424         FREE(ser);
51425         return tag_ptr(ret_conv, true);
51426 }
51427
51428 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
51429         LDKUpdateAddHTLC obj_conv;
51430         obj_conv.inner = untag_ptr(obj);
51431         obj_conv.is_owned = ptr_is_owned(obj);
51432         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51433         obj_conv.is_owned = false;
51434         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51435         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51436         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51437         CVec_u8Z_free(ret_var);
51438         return ret_arr;
51439 }
51440
51441 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
51442         LDKu8slice ser_ref;
51443         ser_ref.datalen = ser->arr_len;
51444         ser_ref.data = ser->elems;
51445         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51446         *ret_conv = UpdateAddHTLC_read(ser_ref);
51447         FREE(ser);
51448         return tag_ptr(ret_conv, true);
51449 }
51450
51451 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
51452         LDKu8slice ser_ref;
51453         ser_ref.datalen = ser->arr_len;
51454         ser_ref.data = ser->elems;
51455         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51456         *ret_conv = OnionMessage_read(ser_ref);
51457         FREE(ser);
51458         return tag_ptr(ret_conv, true);
51459 }
51460
51461 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
51462         LDKOnionMessage obj_conv;
51463         obj_conv.inner = untag_ptr(obj);
51464         obj_conv.is_owned = ptr_is_owned(obj);
51465         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51466         obj_conv.is_owned = false;
51467         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51470         CVec_u8Z_free(ret_var);
51471         return ret_arr;
51472 }
51473
51474 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_write"))) TS_FinalOnionHopData_write(uint64_t obj) {
51475         LDKFinalOnionHopData obj_conv;
51476         obj_conv.inner = untag_ptr(obj);
51477         obj_conv.is_owned = ptr_is_owned(obj);
51478         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51479         obj_conv.is_owned = false;
51480         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
51481         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51482         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51483         CVec_u8Z_free(ret_var);
51484         return ret_arr;
51485 }
51486
51487 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_read"))) TS_FinalOnionHopData_read(int8_tArray ser) {
51488         LDKu8slice ser_ref;
51489         ser_ref.datalen = ser->arr_len;
51490         ser_ref.data = ser->elems;
51491         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
51492         *ret_conv = FinalOnionHopData_read(ser_ref);
51493         FREE(ser);
51494         return tag_ptr(ret_conv, true);
51495 }
51496
51497 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
51498         LDKPing obj_conv;
51499         obj_conv.inner = untag_ptr(obj);
51500         obj_conv.is_owned = ptr_is_owned(obj);
51501         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51502         obj_conv.is_owned = false;
51503         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51504         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51505         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51506         CVec_u8Z_free(ret_var);
51507         return ret_arr;
51508 }
51509
51510 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
51511         LDKu8slice ser_ref;
51512         ser_ref.datalen = ser->arr_len;
51513         ser_ref.data = ser->elems;
51514         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51515         *ret_conv = Ping_read(ser_ref);
51516         FREE(ser);
51517         return tag_ptr(ret_conv, true);
51518 }
51519
51520 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
51521         LDKPong obj_conv;
51522         obj_conv.inner = untag_ptr(obj);
51523         obj_conv.is_owned = ptr_is_owned(obj);
51524         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51525         obj_conv.is_owned = false;
51526         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51527         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51528         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51529         CVec_u8Z_free(ret_var);
51530         return ret_arr;
51531 }
51532
51533 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
51534         LDKu8slice ser_ref;
51535         ser_ref.datalen = ser->arr_len;
51536         ser_ref.data = ser->elems;
51537         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51538         *ret_conv = Pong_read(ser_ref);
51539         FREE(ser);
51540         return tag_ptr(ret_conv, true);
51541 }
51542
51543 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
51544         LDKUnsignedChannelAnnouncement obj_conv;
51545         obj_conv.inner = untag_ptr(obj);
51546         obj_conv.is_owned = ptr_is_owned(obj);
51547         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51548         obj_conv.is_owned = false;
51549         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51550         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51551         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51552         CVec_u8Z_free(ret_var);
51553         return ret_arr;
51554 }
51555
51556 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
51557         LDKu8slice ser_ref;
51558         ser_ref.datalen = ser->arr_len;
51559         ser_ref.data = ser->elems;
51560         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51561         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51562         FREE(ser);
51563         return tag_ptr(ret_conv, true);
51564 }
51565
51566 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
51567         LDKChannelAnnouncement obj_conv;
51568         obj_conv.inner = untag_ptr(obj);
51569         obj_conv.is_owned = ptr_is_owned(obj);
51570         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51571         obj_conv.is_owned = false;
51572         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51573         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51574         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51575         CVec_u8Z_free(ret_var);
51576         return ret_arr;
51577 }
51578
51579 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
51580         LDKu8slice ser_ref;
51581         ser_ref.datalen = ser->arr_len;
51582         ser_ref.data = ser->elems;
51583         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51584         *ret_conv = ChannelAnnouncement_read(ser_ref);
51585         FREE(ser);
51586         return tag_ptr(ret_conv, true);
51587 }
51588
51589 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
51590         LDKUnsignedChannelUpdate obj_conv;
51591         obj_conv.inner = untag_ptr(obj);
51592         obj_conv.is_owned = ptr_is_owned(obj);
51593         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51594         obj_conv.is_owned = false;
51595         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51596         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51597         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51598         CVec_u8Z_free(ret_var);
51599         return ret_arr;
51600 }
51601
51602 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
51603         LDKu8slice ser_ref;
51604         ser_ref.datalen = ser->arr_len;
51605         ser_ref.data = ser->elems;
51606         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
51607         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
51608         FREE(ser);
51609         return tag_ptr(ret_conv, true);
51610 }
51611
51612 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
51613         LDKChannelUpdate obj_conv;
51614         obj_conv.inner = untag_ptr(obj);
51615         obj_conv.is_owned = ptr_is_owned(obj);
51616         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51617         obj_conv.is_owned = false;
51618         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
51619         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51620         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51621         CVec_u8Z_free(ret_var);
51622         return ret_arr;
51623 }
51624
51625 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
51626         LDKu8slice ser_ref;
51627         ser_ref.datalen = ser->arr_len;
51628         ser_ref.data = ser->elems;
51629         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
51630         *ret_conv = ChannelUpdate_read(ser_ref);
51631         FREE(ser);
51632         return tag_ptr(ret_conv, true);
51633 }
51634
51635 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
51636         LDKErrorMessage obj_conv;
51637         obj_conv.inner = untag_ptr(obj);
51638         obj_conv.is_owned = ptr_is_owned(obj);
51639         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51640         obj_conv.is_owned = false;
51641         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
51642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51644         CVec_u8Z_free(ret_var);
51645         return ret_arr;
51646 }
51647
51648 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
51649         LDKu8slice ser_ref;
51650         ser_ref.datalen = ser->arr_len;
51651         ser_ref.data = ser->elems;
51652         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
51653         *ret_conv = ErrorMessage_read(ser_ref);
51654         FREE(ser);
51655         return tag_ptr(ret_conv, true);
51656 }
51657
51658 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
51659         LDKWarningMessage obj_conv;
51660         obj_conv.inner = untag_ptr(obj);
51661         obj_conv.is_owned = ptr_is_owned(obj);
51662         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51663         obj_conv.is_owned = false;
51664         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
51665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51667         CVec_u8Z_free(ret_var);
51668         return ret_arr;
51669 }
51670
51671 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
51672         LDKu8slice ser_ref;
51673         ser_ref.datalen = ser->arr_len;
51674         ser_ref.data = ser->elems;
51675         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
51676         *ret_conv = WarningMessage_read(ser_ref);
51677         FREE(ser);
51678         return tag_ptr(ret_conv, true);
51679 }
51680
51681 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
51682         LDKUnsignedNodeAnnouncement obj_conv;
51683         obj_conv.inner = untag_ptr(obj);
51684         obj_conv.is_owned = ptr_is_owned(obj);
51685         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51686         obj_conv.is_owned = false;
51687         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
51688         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51689         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51690         CVec_u8Z_free(ret_var);
51691         return ret_arr;
51692 }
51693
51694 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
51695         LDKu8slice ser_ref;
51696         ser_ref.datalen = ser->arr_len;
51697         ser_ref.data = ser->elems;
51698         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
51699         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
51700         FREE(ser);
51701         return tag_ptr(ret_conv, true);
51702 }
51703
51704 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
51705         LDKNodeAnnouncement obj_conv;
51706         obj_conv.inner = untag_ptr(obj);
51707         obj_conv.is_owned = ptr_is_owned(obj);
51708         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51709         obj_conv.is_owned = false;
51710         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
51711         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51712         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51713         CVec_u8Z_free(ret_var);
51714         return ret_arr;
51715 }
51716
51717 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
51718         LDKu8slice ser_ref;
51719         ser_ref.datalen = ser->arr_len;
51720         ser_ref.data = ser->elems;
51721         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
51722         *ret_conv = NodeAnnouncement_read(ser_ref);
51723         FREE(ser);
51724         return tag_ptr(ret_conv, true);
51725 }
51726
51727 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
51728         LDKu8slice ser_ref;
51729         ser_ref.datalen = ser->arr_len;
51730         ser_ref.data = ser->elems;
51731         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
51732         *ret_conv = QueryShortChannelIds_read(ser_ref);
51733         FREE(ser);
51734         return tag_ptr(ret_conv, true);
51735 }
51736
51737 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
51738         LDKQueryShortChannelIds obj_conv;
51739         obj_conv.inner = untag_ptr(obj);
51740         obj_conv.is_owned = ptr_is_owned(obj);
51741         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51742         obj_conv.is_owned = false;
51743         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
51744         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51745         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51746         CVec_u8Z_free(ret_var);
51747         return ret_arr;
51748 }
51749
51750 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
51751         LDKReplyShortChannelIdsEnd obj_conv;
51752         obj_conv.inner = untag_ptr(obj);
51753         obj_conv.is_owned = ptr_is_owned(obj);
51754         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51755         obj_conv.is_owned = false;
51756         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
51757         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51758         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51759         CVec_u8Z_free(ret_var);
51760         return ret_arr;
51761 }
51762
51763 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
51764         LDKu8slice ser_ref;
51765         ser_ref.datalen = ser->arr_len;
51766         ser_ref.data = ser->elems;
51767         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
51768         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
51769         FREE(ser);
51770         return tag_ptr(ret_conv, true);
51771 }
51772
51773 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
51774         LDKQueryChannelRange this_arg_conv;
51775         this_arg_conv.inner = untag_ptr(this_arg);
51776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51778         this_arg_conv.is_owned = false;
51779         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
51780         return ret_conv;
51781 }
51782
51783 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
51784         LDKQueryChannelRange obj_conv;
51785         obj_conv.inner = untag_ptr(obj);
51786         obj_conv.is_owned = ptr_is_owned(obj);
51787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51788         obj_conv.is_owned = false;
51789         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
51790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51792         CVec_u8Z_free(ret_var);
51793         return ret_arr;
51794 }
51795
51796 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
51797         LDKu8slice ser_ref;
51798         ser_ref.datalen = ser->arr_len;
51799         ser_ref.data = ser->elems;
51800         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
51801         *ret_conv = QueryChannelRange_read(ser_ref);
51802         FREE(ser);
51803         return tag_ptr(ret_conv, true);
51804 }
51805
51806 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
51807         LDKu8slice ser_ref;
51808         ser_ref.datalen = ser->arr_len;
51809         ser_ref.data = ser->elems;
51810         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
51811         *ret_conv = ReplyChannelRange_read(ser_ref);
51812         FREE(ser);
51813         return tag_ptr(ret_conv, true);
51814 }
51815
51816 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
51817         LDKReplyChannelRange obj_conv;
51818         obj_conv.inner = untag_ptr(obj);
51819         obj_conv.is_owned = ptr_is_owned(obj);
51820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51821         obj_conv.is_owned = false;
51822         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
51823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51825         CVec_u8Z_free(ret_var);
51826         return ret_arr;
51827 }
51828
51829 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
51830         LDKGossipTimestampFilter obj_conv;
51831         obj_conv.inner = untag_ptr(obj);
51832         obj_conv.is_owned = ptr_is_owned(obj);
51833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51834         obj_conv.is_owned = false;
51835         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
51836         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51837         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51838         CVec_u8Z_free(ret_var);
51839         return ret_arr;
51840 }
51841
51842 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
51843         LDKu8slice ser_ref;
51844         ser_ref.datalen = ser->arr_len;
51845         ser_ref.data = ser->elems;
51846         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
51847         *ret_conv = GossipTimestampFilter_read(ser_ref);
51848         FREE(ser);
51849         return tag_ptr(ret_conv, true);
51850 }
51851
51852 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
51853         if (!ptr_is_owned(this_ptr)) return;
51854         void* this_ptr_ptr = untag_ptr(this_ptr);
51855         CHECK_ACCESS(this_ptr_ptr);
51856         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
51857         FREE(untag_ptr(this_ptr));
51858         CustomMessageHandler_free(this_ptr_conv);
51859 }
51860
51861 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
51862         LDKIgnoringMessageHandler this_obj_conv;
51863         this_obj_conv.inner = untag_ptr(this_obj);
51864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51866         IgnoringMessageHandler_free(this_obj_conv);
51867 }
51868
51869 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
51870         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
51871         uint64_t ret_ref = 0;
51872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51874         return ret_ref;
51875 }
51876
51877 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_EventsProvider"))) TS_IgnoringMessageHandler_as_EventsProvider(uint64_t this_arg) {
51878         LDKIgnoringMessageHandler this_arg_conv;
51879         this_arg_conv.inner = untag_ptr(this_arg);
51880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51882         this_arg_conv.is_owned = false;
51883         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
51884         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
51885         return tag_ptr(ret_ret, true);
51886 }
51887
51888 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
51889         LDKIgnoringMessageHandler 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         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51895         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51896         return tag_ptr(ret_ret, true);
51897 }
51898
51899 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
51900         LDKIgnoringMessageHandler this_arg_conv;
51901         this_arg_conv.inner = untag_ptr(this_arg);
51902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51904         this_arg_conv.is_owned = false;
51905         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
51906         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
51907         return tag_ptr(ret_ret, true);
51908 }
51909
51910 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
51911         LDKIgnoringMessageHandler this_arg_conv;
51912         this_arg_conv.inner = untag_ptr(this_arg);
51913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51915         this_arg_conv.is_owned = false;
51916         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
51917         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
51918         return tag_ptr(ret_ret, true);
51919 }
51920
51921 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
51922         LDKIgnoringMessageHandler this_arg_conv;
51923         this_arg_conv.inner = untag_ptr(this_arg);
51924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51926         this_arg_conv.is_owned = false;
51927         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
51928         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
51929         return tag_ptr(ret_ret, true);
51930 }
51931
51932 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
51933         LDKIgnoringMessageHandler this_arg_conv;
51934         this_arg_conv.inner = untag_ptr(this_arg);
51935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51937         this_arg_conv.is_owned = false;
51938         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
51939         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
51940         return tag_ptr(ret_ret, true);
51941 }
51942
51943 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
51944         LDKIgnoringMessageHandler this_arg_conv;
51945         this_arg_conv.inner = untag_ptr(this_arg);
51946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51948         this_arg_conv.is_owned = false;
51949         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
51950         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
51951         return tag_ptr(ret_ret, true);
51952 }
51953
51954 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
51955         LDKIgnoringMessageHandler this_arg_conv;
51956         this_arg_conv.inner = untag_ptr(this_arg);
51957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51959         this_arg_conv.is_owned = false;
51960         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
51961         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
51962         return tag_ptr(ret_ret, true);
51963 }
51964
51965 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
51966         LDKErroringMessageHandler this_obj_conv;
51967         this_obj_conv.inner = untag_ptr(this_obj);
51968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51970         ErroringMessageHandler_free(this_obj_conv);
51971 }
51972
51973 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
51974         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
51975         uint64_t ret_ref = 0;
51976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51978         return ret_ref;
51979 }
51980
51981 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
51982         LDKErroringMessageHandler this_arg_conv;
51983         this_arg_conv.inner = untag_ptr(this_arg);
51984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51986         this_arg_conv.is_owned = false;
51987         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51988         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51989         return tag_ptr(ret_ret, true);
51990 }
51991
51992 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
51993         LDKErroringMessageHandler 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         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
51999         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
52000         return tag_ptr(ret_ret, true);
52001 }
52002
52003 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
52004         LDKMessageHandler this_obj_conv;
52005         this_obj_conv.inner = untag_ptr(this_obj);
52006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52008         MessageHandler_free(this_obj_conv);
52009 }
52010
52011 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
52012         LDKMessageHandler this_ptr_conv;
52013         this_ptr_conv.inner = untag_ptr(this_ptr);
52014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52016         this_ptr_conv.is_owned = false;
52017         // WARNING: This object doesn't live past this scope, needs clone!
52018         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
52019         return ret_ret;
52020 }
52021
52022 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
52023         LDKMessageHandler this_ptr_conv;
52024         this_ptr_conv.inner = untag_ptr(this_ptr);
52025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52027         this_ptr_conv.is_owned = false;
52028         void* val_ptr = untag_ptr(val);
52029         CHECK_ACCESS(val_ptr);
52030         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
52031         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
52032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52033                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
52034         }
52035         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
52036 }
52037
52038 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
52039         LDKMessageHandler this_ptr_conv;
52040         this_ptr_conv.inner = untag_ptr(this_ptr);
52041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52043         this_ptr_conv.is_owned = false;
52044         // WARNING: This object doesn't live past this scope, needs clone!
52045         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
52046         return ret_ret;
52047 }
52048
52049 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
52050         LDKMessageHandler this_ptr_conv;
52051         this_ptr_conv.inner = untag_ptr(this_ptr);
52052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52054         this_ptr_conv.is_owned = false;
52055         void* val_ptr = untag_ptr(val);
52056         CHECK_ACCESS(val_ptr);
52057         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
52058         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52060                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
52061         }
52062         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
52063 }
52064
52065 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
52066         LDKMessageHandler this_ptr_conv;
52067         this_ptr_conv.inner = untag_ptr(this_ptr);
52068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52070         this_ptr_conv.is_owned = false;
52071         // WARNING: This object doesn't live past this scope, needs clone!
52072         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
52073         return ret_ret;
52074 }
52075
52076 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
52077         LDKMessageHandler this_ptr_conv;
52078         this_ptr_conv.inner = untag_ptr(this_ptr);
52079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52081         this_ptr_conv.is_owned = false;
52082         void* val_ptr = untag_ptr(val);
52083         CHECK_ACCESS(val_ptr);
52084         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
52085         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
52086                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52087                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
52088         }
52089         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
52090 }
52091
52092 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
52093         LDKMessageHandler this_ptr_conv;
52094         this_ptr_conv.inner = untag_ptr(this_ptr);
52095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52097         this_ptr_conv.is_owned = false;
52098         // WARNING: This object doesn't live past this scope, needs clone!
52099         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
52100         return ret_ret;
52101 }
52102
52103 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
52104         LDKMessageHandler this_ptr_conv;
52105         this_ptr_conv.inner = untag_ptr(this_ptr);
52106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52108         this_ptr_conv.is_owned = false;
52109         void* val_ptr = untag_ptr(val);
52110         CHECK_ACCESS(val_ptr);
52111         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
52112         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
52113                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52114                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
52115         }
52116         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
52117 }
52118
52119 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) {
52120         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
52121         CHECK_ACCESS(chan_handler_arg_ptr);
52122         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
52123         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
52124                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52125                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
52126         }
52127         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
52128         CHECK_ACCESS(route_handler_arg_ptr);
52129         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
52130         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52131                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52132                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
52133         }
52134         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
52135         CHECK_ACCESS(onion_message_handler_arg_ptr);
52136         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
52137         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
52138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52139                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
52140         }
52141         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
52142         CHECK_ACCESS(custom_message_handler_arg_ptr);
52143         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
52144         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
52145                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52146                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
52147         }
52148         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
52149         uint64_t ret_ref = 0;
52150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52152         return ret_ref;
52153 }
52154
52155 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
52156         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52157         *ret_ret = SocketDescriptor_clone(arg);
52158         return tag_ptr(ret_ret, true);
52159 }
52160 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
52161         void* arg_ptr = untag_ptr(arg);
52162         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52163         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
52164         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
52165         return ret_conv;
52166 }
52167
52168 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
52169         void* orig_ptr = untag_ptr(orig);
52170         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52171         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
52172         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52173         *ret_ret = SocketDescriptor_clone(orig_conv);
52174         return tag_ptr(ret_ret, true);
52175 }
52176
52177 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
52178         if (!ptr_is_owned(this_ptr)) return;
52179         void* this_ptr_ptr = untag_ptr(this_ptr);
52180         CHECK_ACCESS(this_ptr_ptr);
52181         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
52182         FREE(untag_ptr(this_ptr));
52183         SocketDescriptor_free(this_ptr_conv);
52184 }
52185
52186 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
52187         LDKPeerHandleError this_obj_conv;
52188         this_obj_conv.inner = untag_ptr(this_obj);
52189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52191         PeerHandleError_free(this_obj_conv);
52192 }
52193
52194 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
52195         LDKPeerHandleError ret_var = PeerHandleError_new();
52196         uint64_t ret_ref = 0;
52197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52199         return ret_ref;
52200 }
52201
52202 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
52203         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
52204         uint64_t ret_ref = 0;
52205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52207         return ret_ref;
52208 }
52209 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
52210         LDKPeerHandleError arg_conv;
52211         arg_conv.inner = untag_ptr(arg);
52212         arg_conv.is_owned = ptr_is_owned(arg);
52213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52214         arg_conv.is_owned = false;
52215         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
52216         return ret_conv;
52217 }
52218
52219 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
52220         LDKPeerHandleError orig_conv;
52221         orig_conv.inner = untag_ptr(orig);
52222         orig_conv.is_owned = ptr_is_owned(orig);
52223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52224         orig_conv.is_owned = false;
52225         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
52226         uint64_t ret_ref = 0;
52227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52229         return ret_ref;
52230 }
52231
52232 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
52233         LDKPeerManager this_obj_conv;
52234         this_obj_conv.inner = untag_ptr(this_obj);
52235         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52237         PeerManager_free(this_obj_conv);
52238 }
52239
52240 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) {
52241         LDKMessageHandler message_handler_conv;
52242         message_handler_conv.inner = untag_ptr(message_handler);
52243         message_handler_conv.is_owned = ptr_is_owned(message_handler);
52244         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
52245         // WARNING: we need a move here but no clone is available for LDKMessageHandler
52246         
52247         uint8_t ephemeral_random_data_arr[32];
52248         CHECK(ephemeral_random_data->arr_len == 32);
52249         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
52250         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
52251         void* logger_ptr = untag_ptr(logger);
52252         CHECK_ACCESS(logger_ptr);
52253         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52254         if (logger_conv.free == LDKLogger_JCalls_free) {
52255                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52256                 LDKLogger_JCalls_cloned(&logger_conv);
52257         }
52258         void* node_signer_ptr = untag_ptr(node_signer);
52259         CHECK_ACCESS(node_signer_ptr);
52260         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52261         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52263                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52264         }
52265         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
52266         uint64_t ret_ref = 0;
52267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52269         return ret_ref;
52270 }
52271
52272 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
52273         LDKPeerManager this_arg_conv;
52274         this_arg_conv.inner = untag_ptr(this_arg);
52275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52277         this_arg_conv.is_owned = false;
52278         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
52279         uint64_tArray ret_arr = NULL;
52280         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52281         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52282         for (size_t r = 0; r < ret_var.datalen; r++) {
52283                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
52284                 *ret_conv_43_conv = ret_var.data[r];
52285                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
52286         }
52287         
52288         FREE(ret_var.data);
52289         return ret_arr;
52290 }
52291
52292 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) {
52293         LDKPeerManager this_arg_conv;
52294         this_arg_conv.inner = untag_ptr(this_arg);
52295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52297         this_arg_conv.is_owned = false;
52298         LDKPublicKey their_node_id_ref;
52299         CHECK(their_node_id->arr_len == 33);
52300         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
52301         void* descriptor_ptr = untag_ptr(descriptor);
52302         CHECK_ACCESS(descriptor_ptr);
52303         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52304         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52306                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52307         }
52308         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52309         CHECK_ACCESS(remote_network_address_ptr);
52310         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52311         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
52312         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
52313         return tag_ptr(ret_conv, true);
52314 }
52315
52316 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) {
52317         LDKPeerManager 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         void* descriptor_ptr = untag_ptr(descriptor);
52323         CHECK_ACCESS(descriptor_ptr);
52324         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52325         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52326                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52327                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52328         }
52329         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52330         CHECK_ACCESS(remote_network_address_ptr);
52331         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52332         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52333         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
52334         return tag_ptr(ret_conv, true);
52335 }
52336
52337 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
52338         LDKPeerManager this_arg_conv;
52339         this_arg_conv.inner = untag_ptr(this_arg);
52340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52342         this_arg_conv.is_owned = false;
52343         void* descriptor_ptr = untag_ptr(descriptor);
52344         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52345         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52346         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52347         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
52348         return tag_ptr(ret_conv, true);
52349 }
52350
52351 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
52352         LDKPeerManager this_arg_conv;
52353         this_arg_conv.inner = untag_ptr(this_arg);
52354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52356         this_arg_conv.is_owned = false;
52357         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
52358         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
52359         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
52360         LDKu8slice data_ref;
52361         data_ref.datalen = data->arr_len;
52362         data_ref.data = data->elems;
52363         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
52364         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
52365         FREE(data);
52366         return tag_ptr(ret_conv, true);
52367 }
52368
52369 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
52370         LDKPeerManager this_arg_conv;
52371         this_arg_conv.inner = untag_ptr(this_arg);
52372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52374         this_arg_conv.is_owned = false;
52375         PeerManager_process_events(&this_arg_conv);
52376 }
52377
52378 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
52379         LDKPeerManager this_arg_conv;
52380         this_arg_conv.inner = untag_ptr(this_arg);
52381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52383         this_arg_conv.is_owned = false;
52384         void* descriptor_ptr = untag_ptr(descriptor);
52385         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52386         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52387         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
52388 }
52389
52390 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
52391         LDKPeerManager this_arg_conv;
52392         this_arg_conv.inner = untag_ptr(this_arg);
52393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52395         this_arg_conv.is_owned = false;
52396         LDKPublicKey node_id_ref;
52397         CHECK(node_id->arr_len == 33);
52398         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
52399         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
52400 }
52401
52402 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
52403         LDKPeerManager 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         PeerManager_disconnect_all_peers(&this_arg_conv);
52409 }
52410
52411 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
52412         LDKPeerManager 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         PeerManager_timer_tick_occurred(&this_arg_conv);
52418 }
52419
52420 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) {
52421         LDKPeerManager 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         LDKThreeBytes rgb_ref;
52427         CHECK(rgb->arr_len == 3);
52428         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
52429         LDKThirtyTwoBytes alias_ref;
52430         CHECK(alias->arr_len == 32);
52431         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
52432         LDKCVec_SocketAddressZ addresses_constr;
52433         addresses_constr.datalen = addresses->arr_len;
52434         if (addresses_constr.datalen > 0)
52435                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52436         else
52437                 addresses_constr.data = NULL;
52438         uint64_t* addresses_vals = addresses->elems;
52439         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52440                 uint64_t addresses_conv_15 = addresses_vals[p];
52441                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52442                 CHECK_ACCESS(addresses_conv_15_ptr);
52443                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52444                 addresses_constr.data[p] = addresses_conv_15_conv;
52445         }
52446         FREE(addresses);
52447         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52448 }
52449
52450 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
52451         LDKChannelTypeFeatures channel_type_features_conv;
52452         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52453         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52454         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52455         channel_type_features_conv.is_owned = false;
52456         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52457         return ret_conv;
52458 }
52459
52460 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
52461         LDKChannelTypeFeatures channel_type_features_conv;
52462         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52463         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52464         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52465         channel_type_features_conv.is_owned = false;
52466         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52467         return ret_conv;
52468 }
52469
52470 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
52471         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52472         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
52473         return ret_conv;
52474 }
52475
52476 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
52477         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
52478         return ret_conv;
52479 }
52480
52481 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
52482         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
52483         return ret_conv;
52484 }
52485
52486 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
52487         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
52488         return ret_conv;
52489 }
52490
52491 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
52492         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
52493         return ret_conv;
52494 }
52495
52496 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
52497         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
52498         return ret_conv;
52499 }
52500
52501 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
52502         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52503         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52504         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52505         return ret_conv;
52506 }
52507
52508 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
52509         LDKWitness witness_ref;
52510         witness_ref.datalen = witness->arr_len;
52511         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52512         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
52513         witness_ref.data_is_owned = true;
52514         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52515         *ret_copy = HTLCClaim_from_witness(witness_ref);
52516         uint64_t ret_ref = tag_ptr(ret_copy, true);
52517         return ret_ref;
52518 }
52519
52520 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
52521         uint8_t commitment_seed_arr[32];
52522         CHECK(commitment_seed->arr_len == 32);
52523         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
52524         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52525         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52526         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
52527         return ret_arr;
52528 }
52529
52530 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) {
52531         LDKCVec_u8Z to_holder_script_ref;
52532         to_holder_script_ref.datalen = to_holder_script->arr_len;
52533         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52534         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
52535         LDKCVec_u8Z to_counterparty_script_ref;
52536         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
52537         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52538         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
52539         LDKOutPoint funding_outpoint_conv;
52540         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52541         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52542         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52543         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52544         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);
52545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52547         Transaction_free(ret_var);
52548         return ret_arr;
52549 }
52550
52551 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
52552         LDKCounterpartyCommitmentSecrets this_obj_conv;
52553         this_obj_conv.inner = untag_ptr(this_obj);
52554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52556         CounterpartyCommitmentSecrets_free(this_obj_conv);
52557 }
52558
52559 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52560         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52561         uint64_t ret_ref = 0;
52562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52564         return ret_ref;
52565 }
52566 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
52567         LDKCounterpartyCommitmentSecrets arg_conv;
52568         arg_conv.inner = untag_ptr(arg);
52569         arg_conv.is_owned = ptr_is_owned(arg);
52570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52571         arg_conv.is_owned = false;
52572         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52573         return ret_conv;
52574 }
52575
52576 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
52577         LDKCounterpartyCommitmentSecrets orig_conv;
52578         orig_conv.inner = untag_ptr(orig);
52579         orig_conv.is_owned = ptr_is_owned(orig);
52580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52581         orig_conv.is_owned = false;
52582         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52583         uint64_t ret_ref = 0;
52584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52586         return ret_ref;
52587 }
52588
52589 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
52590         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52591         uint64_t ret_ref = 0;
52592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52594         return ret_ref;
52595 }
52596
52597 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
52598         LDKCounterpartyCommitmentSecrets this_arg_conv;
52599         this_arg_conv.inner = untag_ptr(this_arg);
52600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52602         this_arg_conv.is_owned = false;
52603         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
52604         return ret_conv;
52605 }
52606
52607 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
52608         LDKCounterpartyCommitmentSecrets this_arg_conv;
52609         this_arg_conv.inner = untag_ptr(this_arg);
52610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52612         this_arg_conv.is_owned = false;
52613         LDKThirtyTwoBytes secret_ref;
52614         CHECK(secret->arr_len == 32);
52615         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
52616         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52617         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
52618         return tag_ptr(ret_conv, true);
52619 }
52620
52621 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
52622         LDKCounterpartyCommitmentSecrets this_arg_conv;
52623         this_arg_conv.inner = untag_ptr(this_arg);
52624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52626         this_arg_conv.is_owned = false;
52627         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52628         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
52629         return ret_arr;
52630 }
52631
52632 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
52633         LDKCounterpartyCommitmentSecrets obj_conv;
52634         obj_conv.inner = untag_ptr(obj);
52635         obj_conv.is_owned = ptr_is_owned(obj);
52636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52637         obj_conv.is_owned = false;
52638         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
52639         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52640         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52641         CVec_u8Z_free(ret_var);
52642         return ret_arr;
52643 }
52644
52645 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
52646         LDKu8slice ser_ref;
52647         ser_ref.datalen = ser->arr_len;
52648         ser_ref.data = ser->elems;
52649         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
52650         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
52651         FREE(ser);
52652         return tag_ptr(ret_conv, true);
52653 }
52654
52655 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
52656         LDKPublicKey per_commitment_point_ref;
52657         CHECK(per_commitment_point->arr_len == 33);
52658         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
52659         uint8_t base_secret_arr[32];
52660         CHECK(base_secret->arr_len == 32);
52661         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
52662         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
52663         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52664         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
52665         return ret_arr;
52666 }
52667
52668 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) {
52669         uint8_t per_commitment_secret_arr[32];
52670         CHECK(per_commitment_secret->arr_len == 32);
52671         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
52672         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
52673         uint8_t countersignatory_revocation_base_secret_arr[32];
52674         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
52675         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
52676         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
52677         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52678         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
52679         return ret_arr;
52680 }
52681
52682 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
52683         LDKTxCreationKeys this_obj_conv;
52684         this_obj_conv.inner = untag_ptr(this_obj);
52685         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52687         TxCreationKeys_free(this_obj_conv);
52688 }
52689
52690 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
52691         LDKTxCreationKeys this_ptr_conv;
52692         this_ptr_conv.inner = untag_ptr(this_ptr);
52693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52695         this_ptr_conv.is_owned = false;
52696         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52697         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
52698         return ret_arr;
52699 }
52700
52701 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
52702         LDKTxCreationKeys this_ptr_conv;
52703         this_ptr_conv.inner = untag_ptr(this_ptr);
52704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52706         this_ptr_conv.is_owned = false;
52707         LDKPublicKey val_ref;
52708         CHECK(val->arr_len == 33);
52709         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52710         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
52711 }
52712
52713 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
52714         LDKTxCreationKeys this_ptr_conv;
52715         this_ptr_conv.inner = untag_ptr(this_ptr);
52716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52718         this_ptr_conv.is_owned = false;
52719         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
52720         uint64_t ret_ref = 0;
52721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52723         return ret_ref;
52724 }
52725
52726 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, uint64_t val) {
52727         LDKTxCreationKeys this_ptr_conv;
52728         this_ptr_conv.inner = untag_ptr(this_ptr);
52729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52731         this_ptr_conv.is_owned = false;
52732         LDKRevocationKey val_conv;
52733         val_conv.inner = untag_ptr(val);
52734         val_conv.is_owned = ptr_is_owned(val);
52735         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52736         val_conv = RevocationKey_clone(&val_conv);
52737         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
52738 }
52739
52740 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
52741         LDKTxCreationKeys this_ptr_conv;
52742         this_ptr_conv.inner = untag_ptr(this_ptr);
52743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52745         this_ptr_conv.is_owned = false;
52746         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
52747         uint64_t ret_ref = 0;
52748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52750         return ret_ref;
52751 }
52752
52753 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, uint64_t val) {
52754         LDKTxCreationKeys this_ptr_conv;
52755         this_ptr_conv.inner = untag_ptr(this_ptr);
52756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52758         this_ptr_conv.is_owned = false;
52759         LDKHtlcKey val_conv;
52760         val_conv.inner = untag_ptr(val);
52761         val_conv.is_owned = ptr_is_owned(val);
52762         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52763         val_conv = HtlcKey_clone(&val_conv);
52764         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
52765 }
52766
52767 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
52768         LDKTxCreationKeys this_ptr_conv;
52769         this_ptr_conv.inner = untag_ptr(this_ptr);
52770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52772         this_ptr_conv.is_owned = false;
52773         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
52774         uint64_t ret_ref = 0;
52775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52777         return ret_ref;
52778 }
52779
52780 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, uint64_t val) {
52781         LDKTxCreationKeys this_ptr_conv;
52782         this_ptr_conv.inner = untag_ptr(this_ptr);
52783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52785         this_ptr_conv.is_owned = false;
52786         LDKHtlcKey val_conv;
52787         val_conv.inner = untag_ptr(val);
52788         val_conv.is_owned = ptr_is_owned(val);
52789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52790         val_conv = HtlcKey_clone(&val_conv);
52791         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
52792 }
52793
52794 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
52795         LDKTxCreationKeys this_ptr_conv;
52796         this_ptr_conv.inner = untag_ptr(this_ptr);
52797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52799         this_ptr_conv.is_owned = false;
52800         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
52801         uint64_t ret_ref = 0;
52802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52804         return ret_ref;
52805 }
52806
52807 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint64_t this_ptr, uint64_t val) {
52808         LDKTxCreationKeys this_ptr_conv;
52809         this_ptr_conv.inner = untag_ptr(this_ptr);
52810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52812         this_ptr_conv.is_owned = false;
52813         LDKDelayedPaymentKey val_conv;
52814         val_conv.inner = untag_ptr(val);
52815         val_conv.is_owned = ptr_is_owned(val);
52816         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52817         val_conv = DelayedPaymentKey_clone(&val_conv);
52818         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
52819 }
52820
52821 uint64_t  __attribute__((export_name("TS_TxCreationKeys_new"))) TS_TxCreationKeys_new(int8_tArray per_commitment_point_arg, uint64_t revocation_key_arg, uint64_t broadcaster_htlc_key_arg, uint64_t countersignatory_htlc_key_arg, uint64_t broadcaster_delayed_payment_key_arg) {
52822         LDKPublicKey per_commitment_point_arg_ref;
52823         CHECK(per_commitment_point_arg->arr_len == 33);
52824         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
52825         LDKRevocationKey revocation_key_arg_conv;
52826         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
52827         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
52828         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
52829         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
52830         LDKHtlcKey broadcaster_htlc_key_arg_conv;
52831         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
52832         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
52833         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
52834         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
52835         LDKHtlcKey countersignatory_htlc_key_arg_conv;
52836         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
52837         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
52838         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
52839         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
52840         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
52841         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
52842         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
52843         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
52844         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
52845         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
52846         uint64_t ret_ref = 0;
52847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52849         return ret_ref;
52850 }
52851
52852 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
52853         LDKTxCreationKeys a_conv;
52854         a_conv.inner = untag_ptr(a);
52855         a_conv.is_owned = ptr_is_owned(a);
52856         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52857         a_conv.is_owned = false;
52858         LDKTxCreationKeys b_conv;
52859         b_conv.inner = untag_ptr(b);
52860         b_conv.is_owned = ptr_is_owned(b);
52861         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52862         b_conv.is_owned = false;
52863         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
52864         return ret_conv;
52865 }
52866
52867 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
52868         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
52869         uint64_t ret_ref = 0;
52870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52872         return ret_ref;
52873 }
52874 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
52875         LDKTxCreationKeys arg_conv;
52876         arg_conv.inner = untag_ptr(arg);
52877         arg_conv.is_owned = ptr_is_owned(arg);
52878         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52879         arg_conv.is_owned = false;
52880         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
52881         return ret_conv;
52882 }
52883
52884 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
52885         LDKTxCreationKeys orig_conv;
52886         orig_conv.inner = untag_ptr(orig);
52887         orig_conv.is_owned = ptr_is_owned(orig);
52888         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52889         orig_conv.is_owned = false;
52890         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
52891         uint64_t ret_ref = 0;
52892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52894         return ret_ref;
52895 }
52896
52897 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
52898         LDKTxCreationKeys obj_conv;
52899         obj_conv.inner = untag_ptr(obj);
52900         obj_conv.is_owned = ptr_is_owned(obj);
52901         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52902         obj_conv.is_owned = false;
52903         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
52904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52906         CVec_u8Z_free(ret_var);
52907         return ret_arr;
52908 }
52909
52910 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
52911         LDKu8slice ser_ref;
52912         ser_ref.datalen = ser->arr_len;
52913         ser_ref.data = ser->elems;
52914         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
52915         *ret_conv = TxCreationKeys_read(ser_ref);
52916         FREE(ser);
52917         return tag_ptr(ret_conv, true);
52918 }
52919
52920 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
52921         LDKChannelPublicKeys this_obj_conv;
52922         this_obj_conv.inner = untag_ptr(this_obj);
52923         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52925         ChannelPublicKeys_free(this_obj_conv);
52926 }
52927
52928 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
52929         LDKChannelPublicKeys this_ptr_conv;
52930         this_ptr_conv.inner = untag_ptr(this_ptr);
52931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52933         this_ptr_conv.is_owned = false;
52934         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52935         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
52936         return ret_arr;
52937 }
52938
52939 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
52940         LDKChannelPublicKeys this_ptr_conv;
52941         this_ptr_conv.inner = untag_ptr(this_ptr);
52942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52944         this_ptr_conv.is_owned = false;
52945         LDKPublicKey val_ref;
52946         CHECK(val->arr_len == 33);
52947         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52948         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
52949 }
52950
52951 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
52952         LDKChannelPublicKeys this_ptr_conv;
52953         this_ptr_conv.inner = untag_ptr(this_ptr);
52954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52956         this_ptr_conv.is_owned = false;
52957         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
52958         uint64_t ret_ref = 0;
52959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52961         return ret_ref;
52962 }
52963
52964 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, uint64_t val) {
52965         LDKChannelPublicKeys this_ptr_conv;
52966         this_ptr_conv.inner = untag_ptr(this_ptr);
52967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52969         this_ptr_conv.is_owned = false;
52970         LDKRevocationBasepoint val_conv;
52971         val_conv.inner = untag_ptr(val);
52972         val_conv.is_owned = ptr_is_owned(val);
52973         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52974         val_conv = RevocationBasepoint_clone(&val_conv);
52975         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
52976 }
52977
52978 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
52979         LDKChannelPublicKeys this_ptr_conv;
52980         this_ptr_conv.inner = untag_ptr(this_ptr);
52981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52983         this_ptr_conv.is_owned = false;
52984         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52985         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
52986         return ret_arr;
52987 }
52988
52989 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
52990         LDKChannelPublicKeys this_ptr_conv;
52991         this_ptr_conv.inner = untag_ptr(this_ptr);
52992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52994         this_ptr_conv.is_owned = false;
52995         LDKPublicKey val_ref;
52996         CHECK(val->arr_len == 33);
52997         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52998         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
52999 }
53000
53001 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
53002         LDKChannelPublicKeys this_ptr_conv;
53003         this_ptr_conv.inner = untag_ptr(this_ptr);
53004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53006         this_ptr_conv.is_owned = false;
53007         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
53008         uint64_t ret_ref = 0;
53009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53011         return ret_ref;
53012 }
53013
53014 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, uint64_t val) {
53015         LDKChannelPublicKeys this_ptr_conv;
53016         this_ptr_conv.inner = untag_ptr(this_ptr);
53017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53019         this_ptr_conv.is_owned = false;
53020         LDKDelayedPaymentBasepoint val_conv;
53021         val_conv.inner = untag_ptr(val);
53022         val_conv.is_owned = ptr_is_owned(val);
53023         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53024         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
53025         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
53026 }
53027
53028 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
53029         LDKChannelPublicKeys this_ptr_conv;
53030         this_ptr_conv.inner = untag_ptr(this_ptr);
53031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53033         this_ptr_conv.is_owned = false;
53034         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
53035         uint64_t ret_ref = 0;
53036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53038         return ret_ref;
53039 }
53040
53041 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, uint64_t val) {
53042         LDKChannelPublicKeys this_ptr_conv;
53043         this_ptr_conv.inner = untag_ptr(this_ptr);
53044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53046         this_ptr_conv.is_owned = false;
53047         LDKHtlcBasepoint val_conv;
53048         val_conv.inner = untag_ptr(val);
53049         val_conv.is_owned = ptr_is_owned(val);
53050         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53051         val_conv = HtlcBasepoint_clone(&val_conv);
53052         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
53053 }
53054
53055 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_new"))) TS_ChannelPublicKeys_new(int8_tArray funding_pubkey_arg, uint64_t revocation_basepoint_arg, int8_tArray payment_point_arg, uint64_t delayed_payment_basepoint_arg, uint64_t htlc_basepoint_arg) {
53056         LDKPublicKey funding_pubkey_arg_ref;
53057         CHECK(funding_pubkey_arg->arr_len == 33);
53058         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
53059         LDKRevocationBasepoint revocation_basepoint_arg_conv;
53060         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
53061         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
53062         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
53063         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
53064         LDKPublicKey payment_point_arg_ref;
53065         CHECK(payment_point_arg->arr_len == 33);
53066         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
53067         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
53068         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
53069         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
53070         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
53071         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
53072         LDKHtlcBasepoint htlc_basepoint_arg_conv;
53073         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
53074         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
53075         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
53076         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
53077         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_conv, payment_point_arg_ref, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
53078         uint64_t ret_ref = 0;
53079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53081         return ret_ref;
53082 }
53083
53084 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
53085         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
53086         uint64_t ret_ref = 0;
53087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53089         return ret_ref;
53090 }
53091 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
53092         LDKChannelPublicKeys arg_conv;
53093         arg_conv.inner = untag_ptr(arg);
53094         arg_conv.is_owned = ptr_is_owned(arg);
53095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53096         arg_conv.is_owned = false;
53097         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
53098         return ret_conv;
53099 }
53100
53101 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
53102         LDKChannelPublicKeys orig_conv;
53103         orig_conv.inner = untag_ptr(orig);
53104         orig_conv.is_owned = ptr_is_owned(orig);
53105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53106         orig_conv.is_owned = false;
53107         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
53108         uint64_t ret_ref = 0;
53109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53111         return ret_ref;
53112 }
53113
53114 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
53115         LDKChannelPublicKeys o_conv;
53116         o_conv.inner = untag_ptr(o);
53117         o_conv.is_owned = ptr_is_owned(o);
53118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53119         o_conv.is_owned = false;
53120         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
53121         return ret_conv;
53122 }
53123
53124 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
53125         LDKChannelPublicKeys a_conv;
53126         a_conv.inner = untag_ptr(a);
53127         a_conv.is_owned = ptr_is_owned(a);
53128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53129         a_conv.is_owned = false;
53130         LDKChannelPublicKeys b_conv;
53131         b_conv.inner = untag_ptr(b);
53132         b_conv.is_owned = ptr_is_owned(b);
53133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53134         b_conv.is_owned = false;
53135         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
53136         return ret_conv;
53137 }
53138
53139 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
53140         LDKChannelPublicKeys obj_conv;
53141         obj_conv.inner = untag_ptr(obj);
53142         obj_conv.is_owned = ptr_is_owned(obj);
53143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53144         obj_conv.is_owned = false;
53145         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
53146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53148         CVec_u8Z_free(ret_var);
53149         return ret_arr;
53150 }
53151
53152 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
53153         LDKu8slice ser_ref;
53154         ser_ref.datalen = ser->arr_len;
53155         ser_ref.data = ser->elems;
53156         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
53157         *ret_conv = ChannelPublicKeys_read(ser_ref);
53158         FREE(ser);
53159         return tag_ptr(ret_conv, true);
53160 }
53161
53162 uint64_t  __attribute__((export_name("TS_TxCreationKeys_derive_new"))) TS_TxCreationKeys_derive_new(int8_tArray per_commitment_point, uint64_t broadcaster_delayed_payment_base, uint64_t broadcaster_htlc_base, uint64_t countersignatory_revocation_base, uint64_t countersignatory_htlc_base) {
53163         LDKPublicKey per_commitment_point_ref;
53164         CHECK(per_commitment_point->arr_len == 33);
53165         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53166         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
53167         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
53168         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
53169         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
53170         broadcaster_delayed_payment_base_conv.is_owned = false;
53171         LDKHtlcBasepoint broadcaster_htlc_base_conv;
53172         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
53173         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
53174         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
53175         broadcaster_htlc_base_conv.is_owned = false;
53176         LDKRevocationBasepoint countersignatory_revocation_base_conv;
53177         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
53178         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
53179         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
53180         countersignatory_revocation_base_conv.is_owned = false;
53181         LDKHtlcBasepoint countersignatory_htlc_base_conv;
53182         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
53183         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
53184         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
53185         countersignatory_htlc_base_conv.is_owned = false;
53186         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, &broadcaster_delayed_payment_base_conv, &broadcaster_htlc_base_conv, &countersignatory_revocation_base_conv, &countersignatory_htlc_base_conv);
53187         uint64_t ret_ref = 0;
53188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53190         return ret_ref;
53191 }
53192
53193 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) {
53194         LDKPublicKey per_commitment_point_ref;
53195         CHECK(per_commitment_point->arr_len == 33);
53196         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53197         LDKChannelPublicKeys broadcaster_keys_conv;
53198         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
53199         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
53200         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
53201         broadcaster_keys_conv.is_owned = false;
53202         LDKChannelPublicKeys countersignatory_keys_conv;
53203         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
53204         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
53205         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
53206         countersignatory_keys_conv.is_owned = false;
53207         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
53208         uint64_t ret_ref = 0;
53209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53211         return ret_ref;
53212 }
53213
53214 int8_tArray  __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(uint64_t revocation_key, int16_t contest_delay, uint64_t broadcaster_delayed_payment_key) {
53215         LDKRevocationKey revocation_key_conv;
53216         revocation_key_conv.inner = untag_ptr(revocation_key);
53217         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53218         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53219         revocation_key_conv.is_owned = false;
53220         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53221         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53222         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53223         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53224         broadcaster_delayed_payment_key_conv.is_owned = false;
53225         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
53226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53228         CVec_u8Z_free(ret_var);
53229         return ret_arr;
53230 }
53231
53232 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
53233         LDKChannelTypeFeatures channel_type_features_conv;
53234         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53235         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53236         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53237         channel_type_features_conv.is_owned = false;
53238         LDKPublicKey payment_key_ref;
53239         CHECK(payment_key->arr_len == 33);
53240         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
53241         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
53242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53244         CVec_u8Z_free(ret_var);
53245         return ret_arr;
53246 }
53247
53248 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
53249         LDKHTLCOutputInCommitment this_obj_conv;
53250         this_obj_conv.inner = untag_ptr(this_obj);
53251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53253         HTLCOutputInCommitment_free(this_obj_conv);
53254 }
53255
53256 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
53257         LDKHTLCOutputInCommitment this_ptr_conv;
53258         this_ptr_conv.inner = untag_ptr(this_ptr);
53259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53261         this_ptr_conv.is_owned = false;
53262         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
53263         return ret_conv;
53264 }
53265
53266 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
53267         LDKHTLCOutputInCommitment this_ptr_conv;
53268         this_ptr_conv.inner = untag_ptr(this_ptr);
53269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53271         this_ptr_conv.is_owned = false;
53272         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
53273 }
53274
53275 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
53276         LDKHTLCOutputInCommitment this_ptr_conv;
53277         this_ptr_conv.inner = untag_ptr(this_ptr);
53278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53280         this_ptr_conv.is_owned = false;
53281         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
53282         return ret_conv;
53283 }
53284
53285 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
53286         LDKHTLCOutputInCommitment this_ptr_conv;
53287         this_ptr_conv.inner = untag_ptr(this_ptr);
53288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53290         this_ptr_conv.is_owned = false;
53291         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
53292 }
53293
53294 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
53295         LDKHTLCOutputInCommitment this_ptr_conv;
53296         this_ptr_conv.inner = untag_ptr(this_ptr);
53297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53299         this_ptr_conv.is_owned = false;
53300         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
53301         return ret_conv;
53302 }
53303
53304 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
53305         LDKHTLCOutputInCommitment this_ptr_conv;
53306         this_ptr_conv.inner = untag_ptr(this_ptr);
53307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53309         this_ptr_conv.is_owned = false;
53310         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
53311 }
53312
53313 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
53314         LDKHTLCOutputInCommitment this_ptr_conv;
53315         this_ptr_conv.inner = untag_ptr(this_ptr);
53316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53318         this_ptr_conv.is_owned = false;
53319         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53320         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
53321         return ret_arr;
53322 }
53323
53324 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
53325         LDKHTLCOutputInCommitment this_ptr_conv;
53326         this_ptr_conv.inner = untag_ptr(this_ptr);
53327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53329         this_ptr_conv.is_owned = false;
53330         LDKThirtyTwoBytes val_ref;
53331         CHECK(val->arr_len == 32);
53332         memcpy(val_ref.data, val->elems, 32); FREE(val);
53333         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
53334 }
53335
53336 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
53337         LDKHTLCOutputInCommitment this_ptr_conv;
53338         this_ptr_conv.inner = untag_ptr(this_ptr);
53339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53341         this_ptr_conv.is_owned = false;
53342         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53343         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
53344         uint64_t ret_ref = tag_ptr(ret_copy, true);
53345         return ret_ref;
53346 }
53347
53348 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
53349         LDKHTLCOutputInCommitment this_ptr_conv;
53350         this_ptr_conv.inner = untag_ptr(this_ptr);
53351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53353         this_ptr_conv.is_owned = false;
53354         void* val_ptr = untag_ptr(val);
53355         CHECK_ACCESS(val_ptr);
53356         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
53357         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
53358         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
53359 }
53360
53361 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) {
53362         LDKThirtyTwoBytes payment_hash_arg_ref;
53363         CHECK(payment_hash_arg->arr_len == 32);
53364         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
53365         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
53366         CHECK_ACCESS(transaction_output_index_arg_ptr);
53367         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
53368         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
53369         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
53370         uint64_t ret_ref = 0;
53371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53373         return ret_ref;
53374 }
53375
53376 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
53377         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
53378         uint64_t ret_ref = 0;
53379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53381         return ret_ref;
53382 }
53383 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
53384         LDKHTLCOutputInCommitment arg_conv;
53385         arg_conv.inner = untag_ptr(arg);
53386         arg_conv.is_owned = ptr_is_owned(arg);
53387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53388         arg_conv.is_owned = false;
53389         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
53390         return ret_conv;
53391 }
53392
53393 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
53394         LDKHTLCOutputInCommitment orig_conv;
53395         orig_conv.inner = untag_ptr(orig);
53396         orig_conv.is_owned = ptr_is_owned(orig);
53397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53398         orig_conv.is_owned = false;
53399         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
53400         uint64_t ret_ref = 0;
53401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53403         return ret_ref;
53404 }
53405
53406 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
53407         LDKHTLCOutputInCommitment a_conv;
53408         a_conv.inner = untag_ptr(a);
53409         a_conv.is_owned = ptr_is_owned(a);
53410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53411         a_conv.is_owned = false;
53412         LDKHTLCOutputInCommitment b_conv;
53413         b_conv.inner = untag_ptr(b);
53414         b_conv.is_owned = ptr_is_owned(b);
53415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53416         b_conv.is_owned = false;
53417         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
53418         return ret_conv;
53419 }
53420
53421 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
53422         LDKHTLCOutputInCommitment obj_conv;
53423         obj_conv.inner = untag_ptr(obj);
53424         obj_conv.is_owned = ptr_is_owned(obj);
53425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53426         obj_conv.is_owned = false;
53427         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
53428         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53429         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53430         CVec_u8Z_free(ret_var);
53431         return ret_arr;
53432 }
53433
53434 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
53435         LDKu8slice ser_ref;
53436         ser_ref.datalen = ser->arr_len;
53437         ser_ref.data = ser->elems;
53438         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
53439         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
53440         FREE(ser);
53441         return tag_ptr(ret_conv, true);
53442 }
53443
53444 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
53445         LDKHTLCOutputInCommitment htlc_conv;
53446         htlc_conv.inner = untag_ptr(htlc);
53447         htlc_conv.is_owned = ptr_is_owned(htlc);
53448         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53449         htlc_conv.is_owned = false;
53450         LDKChannelTypeFeatures channel_type_features_conv;
53451         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53452         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53453         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53454         channel_type_features_conv.is_owned = false;
53455         LDKTxCreationKeys keys_conv;
53456         keys_conv.inner = untag_ptr(keys);
53457         keys_conv.is_owned = ptr_is_owned(keys);
53458         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53459         keys_conv.is_owned = false;
53460         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53461         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53462         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53463         CVec_u8Z_free(ret_var);
53464         return ret_arr;
53465 }
53466
53467 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
53468         LDKPublicKey broadcaster_ref;
53469         CHECK(broadcaster->arr_len == 33);
53470         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
53471         LDKPublicKey countersignatory_ref;
53472         CHECK(countersignatory->arr_len == 33);
53473         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
53474         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53475         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53476         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53477         CVec_u8Z_free(ret_var);
53478         return ret_arr;
53479 }
53480
53481 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, uint64_t broadcaster_delayed_payment_key, uint64_t revocation_key) {
53482         uint8_t commitment_txid_arr[32];
53483         CHECK(commitment_txid->arr_len == 32);
53484         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
53485         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53486         LDKHTLCOutputInCommitment htlc_conv;
53487         htlc_conv.inner = untag_ptr(htlc);
53488         htlc_conv.is_owned = ptr_is_owned(htlc);
53489         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53490         htlc_conv.is_owned = false;
53491         LDKChannelTypeFeatures channel_type_features_conv;
53492         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53493         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53494         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53495         channel_type_features_conv.is_owned = false;
53496         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53497         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53498         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53499         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53500         broadcaster_delayed_payment_key_conv.is_owned = false;
53501         LDKRevocationKey revocation_key_conv;
53502         revocation_key_conv.inner = untag_ptr(revocation_key);
53503         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53505         revocation_key_conv.is_owned = false;
53506         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, &broadcaster_delayed_payment_key_conv, &revocation_key_conv);
53507         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53508         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53509         Transaction_free(ret_var);
53510         return ret_arr;
53511 }
53512
53513 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) {
53514         LDKECDSASignature local_sig_ref;
53515         CHECK(local_sig->arr_len == 64);
53516         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
53517         LDKECDSASignature remote_sig_ref;
53518         CHECK(remote_sig->arr_len == 64);
53519         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
53520         void* preimage_ptr = untag_ptr(preimage);
53521         CHECK_ACCESS(preimage_ptr);
53522         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53523         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53524         LDKu8slice redeem_script_ref;
53525         redeem_script_ref.datalen = redeem_script->arr_len;
53526         redeem_script_ref.data = redeem_script->elems;
53527         LDKChannelTypeFeatures channel_type_features_conv;
53528         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53529         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53531         channel_type_features_conv.is_owned = false;
53532         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53535         Witness_free(ret_var);
53536         FREE(redeem_script);
53537         return ret_arr;
53538 }
53539
53540 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
53541         LDKPublicKey payment_point_ref;
53542         CHECK(payment_point->arr_len == 33);
53543         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
53544         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53547         CVec_u8Z_free(ret_var);
53548         return ret_arr;
53549 }
53550
53551 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
53552         LDKPublicKey funding_pubkey_ref;
53553         CHECK(funding_pubkey->arr_len == 33);
53554         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
53555         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53556         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53557         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53558         CVec_u8Z_free(ret_var);
53559         return ret_arr;
53560 }
53561
53562 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
53563         LDKPublicKey funding_key_ref;
53564         CHECK(funding_key->arr_len == 33);
53565         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
53566         LDKECDSASignature funding_sig_ref;
53567         CHECK(funding_sig->arr_len == 64);
53568         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
53569         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53570         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53571         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53572         Witness_free(ret_var);
53573         return ret_arr;
53574 }
53575
53576 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
53577         LDKChannelTransactionParameters this_obj_conv;
53578         this_obj_conv.inner = untag_ptr(this_obj);
53579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53581         ChannelTransactionParameters_free(this_obj_conv);
53582 }
53583
53584 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
53585         LDKChannelTransactionParameters this_ptr_conv;
53586         this_ptr_conv.inner = untag_ptr(this_ptr);
53587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53589         this_ptr_conv.is_owned = false;
53590         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53591         uint64_t ret_ref = 0;
53592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53594         return ret_ref;
53595 }
53596
53597 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
53598         LDKChannelTransactionParameters this_ptr_conv;
53599         this_ptr_conv.inner = untag_ptr(this_ptr);
53600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53602         this_ptr_conv.is_owned = false;
53603         LDKChannelPublicKeys val_conv;
53604         val_conv.inner = untag_ptr(val);
53605         val_conv.is_owned = ptr_is_owned(val);
53606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53607         val_conv = ChannelPublicKeys_clone(&val_conv);
53608         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
53609 }
53610
53611 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
53612         LDKChannelTransactionParameters this_ptr_conv;
53613         this_ptr_conv.inner = untag_ptr(this_ptr);
53614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53616         this_ptr_conv.is_owned = false;
53617         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
53618         return ret_conv;
53619 }
53620
53621 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) {
53622         LDKChannelTransactionParameters this_ptr_conv;
53623         this_ptr_conv.inner = untag_ptr(this_ptr);
53624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53626         this_ptr_conv.is_owned = false;
53627         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
53628 }
53629
53630 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
53631         LDKChannelTransactionParameters this_ptr_conv;
53632         this_ptr_conv.inner = untag_ptr(this_ptr);
53633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53635         this_ptr_conv.is_owned = false;
53636         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
53637         return ret_conv;
53638 }
53639
53640 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
53641         LDKChannelTransactionParameters this_ptr_conv;
53642         this_ptr_conv.inner = untag_ptr(this_ptr);
53643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53645         this_ptr_conv.is_owned = false;
53646         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
53647 }
53648
53649 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
53650         LDKChannelTransactionParameters this_ptr_conv;
53651         this_ptr_conv.inner = untag_ptr(this_ptr);
53652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53654         this_ptr_conv.is_owned = false;
53655         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
53656         uint64_t ret_ref = 0;
53657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53659         return ret_ref;
53660 }
53661
53662 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
53663         LDKChannelTransactionParameters this_ptr_conv;
53664         this_ptr_conv.inner = untag_ptr(this_ptr);
53665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53667         this_ptr_conv.is_owned = false;
53668         LDKCounterpartyChannelTransactionParameters val_conv;
53669         val_conv.inner = untag_ptr(val);
53670         val_conv.is_owned = ptr_is_owned(val);
53671         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53672         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
53673         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
53674 }
53675
53676 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
53677         LDKChannelTransactionParameters this_ptr_conv;
53678         this_ptr_conv.inner = untag_ptr(this_ptr);
53679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53681         this_ptr_conv.is_owned = false;
53682         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
53683         uint64_t ret_ref = 0;
53684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53686         return ret_ref;
53687 }
53688
53689 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
53690         LDKChannelTransactionParameters this_ptr_conv;
53691         this_ptr_conv.inner = untag_ptr(this_ptr);
53692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53694         this_ptr_conv.is_owned = false;
53695         LDKOutPoint val_conv;
53696         val_conv.inner = untag_ptr(val);
53697         val_conv.is_owned = ptr_is_owned(val);
53698         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53699         val_conv = OutPoint_clone(&val_conv);
53700         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
53701 }
53702
53703 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
53704         LDKChannelTransactionParameters this_ptr_conv;
53705         this_ptr_conv.inner = untag_ptr(this_ptr);
53706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53708         this_ptr_conv.is_owned = false;
53709         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
53710         uint64_t ret_ref = 0;
53711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53713         return ret_ref;
53714 }
53715
53716 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
53717         LDKChannelTransactionParameters this_ptr_conv;
53718         this_ptr_conv.inner = untag_ptr(this_ptr);
53719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53721         this_ptr_conv.is_owned = false;
53722         LDKChannelTypeFeatures val_conv;
53723         val_conv.inner = untag_ptr(val);
53724         val_conv.is_owned = ptr_is_owned(val);
53725         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53726         val_conv = ChannelTypeFeatures_clone(&val_conv);
53727         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
53728 }
53729
53730 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) {
53731         LDKChannelPublicKeys holder_pubkeys_arg_conv;
53732         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
53733         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
53734         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
53735         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
53736         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
53737         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
53738         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
53739         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
53740         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
53741         LDKOutPoint funding_outpoint_arg_conv;
53742         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
53743         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
53744         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
53745         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
53746         LDKChannelTypeFeatures channel_type_features_arg_conv;
53747         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
53748         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
53749         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
53750         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
53751         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);
53752         uint64_t ret_ref = 0;
53753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53755         return ret_ref;
53756 }
53757
53758 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
53759         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
53760         uint64_t ret_ref = 0;
53761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53763         return ret_ref;
53764 }
53765 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
53766         LDKChannelTransactionParameters arg_conv;
53767         arg_conv.inner = untag_ptr(arg);
53768         arg_conv.is_owned = ptr_is_owned(arg);
53769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53770         arg_conv.is_owned = false;
53771         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
53772         return ret_conv;
53773 }
53774
53775 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
53776         LDKChannelTransactionParameters orig_conv;
53777         orig_conv.inner = untag_ptr(orig);
53778         orig_conv.is_owned = ptr_is_owned(orig);
53779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53780         orig_conv.is_owned = false;
53781         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
53782         uint64_t ret_ref = 0;
53783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53785         return ret_ref;
53786 }
53787
53788 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
53789         LDKChannelTransactionParameters o_conv;
53790         o_conv.inner = untag_ptr(o);
53791         o_conv.is_owned = ptr_is_owned(o);
53792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53793         o_conv.is_owned = false;
53794         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
53795         return ret_conv;
53796 }
53797
53798 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
53799         LDKChannelTransactionParameters a_conv;
53800         a_conv.inner = untag_ptr(a);
53801         a_conv.is_owned = ptr_is_owned(a);
53802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53803         a_conv.is_owned = false;
53804         LDKChannelTransactionParameters b_conv;
53805         b_conv.inner = untag_ptr(b);
53806         b_conv.is_owned = ptr_is_owned(b);
53807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53808         b_conv.is_owned = false;
53809         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
53810         return ret_conv;
53811 }
53812
53813 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
53814         LDKCounterpartyChannelTransactionParameters this_obj_conv;
53815         this_obj_conv.inner = untag_ptr(this_obj);
53816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53818         CounterpartyChannelTransactionParameters_free(this_obj_conv);
53819 }
53820
53821 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
53822         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53823         this_ptr_conv.inner = untag_ptr(this_ptr);
53824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53826         this_ptr_conv.is_owned = false;
53827         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
53828         uint64_t ret_ref = 0;
53829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53831         return ret_ref;
53832 }
53833
53834 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
53835         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53836         this_ptr_conv.inner = untag_ptr(this_ptr);
53837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53839         this_ptr_conv.is_owned = false;
53840         LDKChannelPublicKeys val_conv;
53841         val_conv.inner = untag_ptr(val);
53842         val_conv.is_owned = ptr_is_owned(val);
53843         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53844         val_conv = ChannelPublicKeys_clone(&val_conv);
53845         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
53846 }
53847
53848 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
53849         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53850         this_ptr_conv.inner = untag_ptr(this_ptr);
53851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53853         this_ptr_conv.is_owned = false;
53854         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
53855         return ret_conv;
53856 }
53857
53858 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
53859         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53860         this_ptr_conv.inner = untag_ptr(this_ptr);
53861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53863         this_ptr_conv.is_owned = false;
53864         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
53865 }
53866
53867 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
53868         LDKChannelPublicKeys pubkeys_arg_conv;
53869         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
53870         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
53871         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
53872         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
53873         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
53874         uint64_t ret_ref = 0;
53875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53877         return ret_ref;
53878 }
53879
53880 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
53881         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
53882         uint64_t ret_ref = 0;
53883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53885         return ret_ref;
53886 }
53887 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
53888         LDKCounterpartyChannelTransactionParameters arg_conv;
53889         arg_conv.inner = untag_ptr(arg);
53890         arg_conv.is_owned = ptr_is_owned(arg);
53891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53892         arg_conv.is_owned = false;
53893         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
53894         return ret_conv;
53895 }
53896
53897 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
53898         LDKCounterpartyChannelTransactionParameters orig_conv;
53899         orig_conv.inner = untag_ptr(orig);
53900         orig_conv.is_owned = ptr_is_owned(orig);
53901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53902         orig_conv.is_owned = false;
53903         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
53904         uint64_t ret_ref = 0;
53905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53907         return ret_ref;
53908 }
53909
53910 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
53911         LDKCounterpartyChannelTransactionParameters o_conv;
53912         o_conv.inner = untag_ptr(o);
53913         o_conv.is_owned = ptr_is_owned(o);
53914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53915         o_conv.is_owned = false;
53916         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
53917         return ret_conv;
53918 }
53919
53920 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
53921         LDKCounterpartyChannelTransactionParameters a_conv;
53922         a_conv.inner = untag_ptr(a);
53923         a_conv.is_owned = ptr_is_owned(a);
53924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53925         a_conv.is_owned = false;
53926         LDKCounterpartyChannelTransactionParameters b_conv;
53927         b_conv.inner = untag_ptr(b);
53928         b_conv.is_owned = ptr_is_owned(b);
53929         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53930         b_conv.is_owned = false;
53931         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
53932         return ret_conv;
53933 }
53934
53935 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
53936         LDKChannelTransactionParameters this_arg_conv;
53937         this_arg_conv.inner = untag_ptr(this_arg);
53938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53940         this_arg_conv.is_owned = false;
53941         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
53942         return ret_conv;
53943 }
53944
53945 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
53946         LDKChannelTransactionParameters this_arg_conv;
53947         this_arg_conv.inner = untag_ptr(this_arg);
53948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53950         this_arg_conv.is_owned = false;
53951         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
53952         uint64_t ret_ref = 0;
53953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53955         return ret_ref;
53956 }
53957
53958 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
53959         LDKChannelTransactionParameters this_arg_conv;
53960         this_arg_conv.inner = untag_ptr(this_arg);
53961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53963         this_arg_conv.is_owned = false;
53964         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
53965         uint64_t ret_ref = 0;
53966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53968         return ret_ref;
53969 }
53970
53971 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
53972         LDKCounterpartyChannelTransactionParameters obj_conv;
53973         obj_conv.inner = untag_ptr(obj);
53974         obj_conv.is_owned = ptr_is_owned(obj);
53975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53976         obj_conv.is_owned = false;
53977         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
53978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53980         CVec_u8Z_free(ret_var);
53981         return ret_arr;
53982 }
53983
53984 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
53985         LDKu8slice ser_ref;
53986         ser_ref.datalen = ser->arr_len;
53987         ser_ref.data = ser->elems;
53988         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
53989         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
53990         FREE(ser);
53991         return tag_ptr(ret_conv, true);
53992 }
53993
53994 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
53995         LDKChannelTransactionParameters obj_conv;
53996         obj_conv.inner = untag_ptr(obj);
53997         obj_conv.is_owned = ptr_is_owned(obj);
53998         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53999         obj_conv.is_owned = false;
54000         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
54001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54003         CVec_u8Z_free(ret_var);
54004         return ret_arr;
54005 }
54006
54007 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
54008         LDKu8slice ser_ref;
54009         ser_ref.datalen = ser->arr_len;
54010         ser_ref.data = ser->elems;
54011         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
54012         *ret_conv = ChannelTransactionParameters_read(ser_ref);
54013         FREE(ser);
54014         return tag_ptr(ret_conv, true);
54015 }
54016
54017 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
54018         LDKDirectedChannelTransactionParameters this_obj_conv;
54019         this_obj_conv.inner = untag_ptr(this_obj);
54020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54022         DirectedChannelTransactionParameters_free(this_obj_conv);
54023 }
54024
54025 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
54026         LDKDirectedChannelTransactionParameters this_arg_conv;
54027         this_arg_conv.inner = untag_ptr(this_arg);
54028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54030         this_arg_conv.is_owned = false;
54031         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
54032         uint64_t ret_ref = 0;
54033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54035         return ret_ref;
54036 }
54037
54038 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
54039         LDKDirectedChannelTransactionParameters this_arg_conv;
54040         this_arg_conv.inner = untag_ptr(this_arg);
54041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54043         this_arg_conv.is_owned = false;
54044         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
54045         uint64_t ret_ref = 0;
54046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54048         return ret_ref;
54049 }
54050
54051 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
54052         LDKDirectedChannelTransactionParameters this_arg_conv;
54053         this_arg_conv.inner = untag_ptr(this_arg);
54054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54056         this_arg_conv.is_owned = false;
54057         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
54058         return ret_conv;
54059 }
54060
54061 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
54062         LDKDirectedChannelTransactionParameters this_arg_conv;
54063         this_arg_conv.inner = untag_ptr(this_arg);
54064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54066         this_arg_conv.is_owned = false;
54067         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
54068         return ret_conv;
54069 }
54070
54071 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
54072         LDKDirectedChannelTransactionParameters this_arg_conv;
54073         this_arg_conv.inner = untag_ptr(this_arg);
54074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54076         this_arg_conv.is_owned = false;
54077         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
54078         uint64_t ret_ref = 0;
54079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54081         return ret_ref;
54082 }
54083
54084 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
54085         LDKDirectedChannelTransactionParameters this_arg_conv;
54086         this_arg_conv.inner = untag_ptr(this_arg);
54087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54089         this_arg_conv.is_owned = false;
54090         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
54091         uint64_t ret_ref = 0;
54092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54094         return ret_ref;
54095 }
54096
54097 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
54098         LDKHolderCommitmentTransaction this_obj_conv;
54099         this_obj_conv.inner = untag_ptr(this_obj);
54100         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54102         HolderCommitmentTransaction_free(this_obj_conv);
54103 }
54104
54105 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
54106         LDKHolderCommitmentTransaction this_ptr_conv;
54107         this_ptr_conv.inner = untag_ptr(this_ptr);
54108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54110         this_ptr_conv.is_owned = false;
54111         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54112         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
54113         return ret_arr;
54114 }
54115
54116 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
54117         LDKHolderCommitmentTransaction this_ptr_conv;
54118         this_ptr_conv.inner = untag_ptr(this_ptr);
54119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54121         this_ptr_conv.is_owned = false;
54122         LDKECDSASignature val_ref;
54123         CHECK(val->arr_len == 64);
54124         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54125         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
54126 }
54127
54128 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
54129         LDKHolderCommitmentTransaction this_ptr_conv;
54130         this_ptr_conv.inner = untag_ptr(this_ptr);
54131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54133         this_ptr_conv.is_owned = false;
54134         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
54135         ptrArray ret_arr = NULL;
54136         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54137         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54138         for (size_t m = 0; m < ret_var.datalen; m++) {
54139                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
54140                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
54141                 ret_arr_ptr[m] = ret_conv_12_arr;
54142         }
54143         
54144         FREE(ret_var.data);
54145         return ret_arr;
54146 }
54147
54148 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
54149         LDKHolderCommitmentTransaction this_ptr_conv;
54150         this_ptr_conv.inner = untag_ptr(this_ptr);
54151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54153         this_ptr_conv.is_owned = false;
54154         LDKCVec_ECDSASignatureZ val_constr;
54155         val_constr.datalen = val->arr_len;
54156         if (val_constr.datalen > 0)
54157                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54158         else
54159                 val_constr.data = NULL;
54160         int8_tArray* val_vals = (void*) val->elems;
54161         for (size_t m = 0; m < val_constr.datalen; m++) {
54162                 int8_tArray val_conv_12 = val_vals[m];
54163                 LDKECDSASignature val_conv_12_ref;
54164                 CHECK(val_conv_12->arr_len == 64);
54165                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
54166                 val_constr.data[m] = val_conv_12_ref;
54167         }
54168         FREE(val);
54169         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
54170 }
54171
54172 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
54173         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
54174         uint64_t ret_ref = 0;
54175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54177         return ret_ref;
54178 }
54179 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
54180         LDKHolderCommitmentTransaction arg_conv;
54181         arg_conv.inner = untag_ptr(arg);
54182         arg_conv.is_owned = ptr_is_owned(arg);
54183         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54184         arg_conv.is_owned = false;
54185         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
54186         return ret_conv;
54187 }
54188
54189 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
54190         LDKHolderCommitmentTransaction orig_conv;
54191         orig_conv.inner = untag_ptr(orig);
54192         orig_conv.is_owned = ptr_is_owned(orig);
54193         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54194         orig_conv.is_owned = false;
54195         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_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 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
54203         LDKHolderCommitmentTransaction obj_conv;
54204         obj_conv.inner = untag_ptr(obj);
54205         obj_conv.is_owned = ptr_is_owned(obj);
54206         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54207         obj_conv.is_owned = false;
54208         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
54209         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54210         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54211         CVec_u8Z_free(ret_var);
54212         return ret_arr;
54213 }
54214
54215 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
54216         LDKu8slice ser_ref;
54217         ser_ref.datalen = ser->arr_len;
54218         ser_ref.data = ser->elems;
54219         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
54220         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
54221         FREE(ser);
54222         return tag_ptr(ret_conv, true);
54223 }
54224
54225 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) {
54226         LDKCommitmentTransaction commitment_tx_conv;
54227         commitment_tx_conv.inner = untag_ptr(commitment_tx);
54228         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
54229         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
54230         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
54231         LDKECDSASignature counterparty_sig_ref;
54232         CHECK(counterparty_sig->arr_len == 64);
54233         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
54234         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
54235         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
54236         if (counterparty_htlc_sigs_constr.datalen > 0)
54237                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54238         else
54239                 counterparty_htlc_sigs_constr.data = NULL;
54240         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
54241         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
54242                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
54243                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
54244                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
54245                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
54246                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
54247         }
54248         FREE(counterparty_htlc_sigs);
54249         LDKPublicKey holder_funding_key_ref;
54250         CHECK(holder_funding_key->arr_len == 33);
54251         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
54252         LDKPublicKey counterparty_funding_key_ref;
54253         CHECK(counterparty_funding_key->arr_len == 33);
54254         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
54255         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
54256         uint64_t ret_ref = 0;
54257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54259         return ret_ref;
54260 }
54261
54262 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
54263         LDKBuiltCommitmentTransaction this_obj_conv;
54264         this_obj_conv.inner = untag_ptr(this_obj);
54265         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54267         BuiltCommitmentTransaction_free(this_obj_conv);
54268 }
54269
54270 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
54271         LDKBuiltCommitmentTransaction this_ptr_conv;
54272         this_ptr_conv.inner = untag_ptr(this_ptr);
54273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54275         this_ptr_conv.is_owned = false;
54276         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
54277         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54278         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54279         Transaction_free(ret_var);
54280         return ret_arr;
54281 }
54282
54283 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
54284         LDKBuiltCommitmentTransaction this_ptr_conv;
54285         this_ptr_conv.inner = untag_ptr(this_ptr);
54286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54288         this_ptr_conv.is_owned = false;
54289         LDKTransaction val_ref;
54290         val_ref.datalen = val->arr_len;
54291         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
54292         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54293         val_ref.data_is_owned = true;
54294         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
54295 }
54296
54297 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
54298         LDKBuiltCommitmentTransaction this_ptr_conv;
54299         this_ptr_conv.inner = untag_ptr(this_ptr);
54300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54302         this_ptr_conv.is_owned = false;
54303         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54304         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
54305         return ret_arr;
54306 }
54307
54308 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
54309         LDKBuiltCommitmentTransaction this_ptr_conv;
54310         this_ptr_conv.inner = untag_ptr(this_ptr);
54311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54313         this_ptr_conv.is_owned = false;
54314         LDKThirtyTwoBytes val_ref;
54315         CHECK(val->arr_len == 32);
54316         memcpy(val_ref.data, val->elems, 32); FREE(val);
54317         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
54318 }
54319
54320 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
54321         LDKTransaction transaction_arg_ref;
54322         transaction_arg_ref.datalen = transaction_arg->arr_len;
54323         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
54324         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
54325         transaction_arg_ref.data_is_owned = true;
54326         LDKThirtyTwoBytes txid_arg_ref;
54327         CHECK(txid_arg->arr_len == 32);
54328         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
54329         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
54330         uint64_t ret_ref = 0;
54331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54333         return ret_ref;
54334 }
54335
54336 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
54337         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
54338         uint64_t ret_ref = 0;
54339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54341         return ret_ref;
54342 }
54343 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
54344         LDKBuiltCommitmentTransaction arg_conv;
54345         arg_conv.inner = untag_ptr(arg);
54346         arg_conv.is_owned = ptr_is_owned(arg);
54347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54348         arg_conv.is_owned = false;
54349         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
54350         return ret_conv;
54351 }
54352
54353 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
54354         LDKBuiltCommitmentTransaction orig_conv;
54355         orig_conv.inner = untag_ptr(orig);
54356         orig_conv.is_owned = ptr_is_owned(orig);
54357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54358         orig_conv.is_owned = false;
54359         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
54360         uint64_t ret_ref = 0;
54361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54363         return ret_ref;
54364 }
54365
54366 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
54367         LDKBuiltCommitmentTransaction obj_conv;
54368         obj_conv.inner = untag_ptr(obj);
54369         obj_conv.is_owned = ptr_is_owned(obj);
54370         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54371         obj_conv.is_owned = false;
54372         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
54373         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54374         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54375         CVec_u8Z_free(ret_var);
54376         return ret_arr;
54377 }
54378
54379 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
54380         LDKu8slice ser_ref;
54381         ser_ref.datalen = ser->arr_len;
54382         ser_ref.data = ser->elems;
54383         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
54384         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
54385         FREE(ser);
54386         return tag_ptr(ret_conv, true);
54387 }
54388
54389 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) {
54390         LDKBuiltCommitmentTransaction this_arg_conv;
54391         this_arg_conv.inner = untag_ptr(this_arg);
54392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54394         this_arg_conv.is_owned = false;
54395         LDKu8slice funding_redeemscript_ref;
54396         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54397         funding_redeemscript_ref.data = funding_redeemscript->elems;
54398         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54399         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
54400         FREE(funding_redeemscript);
54401         return ret_arr;
54402 }
54403
54404 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) {
54405         LDKBuiltCommitmentTransaction this_arg_conv;
54406         this_arg_conv.inner = untag_ptr(this_arg);
54407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54409         this_arg_conv.is_owned = false;
54410         uint8_t funding_key_arr[32];
54411         CHECK(funding_key->arr_len == 32);
54412         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54413         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54414         LDKu8slice funding_redeemscript_ref;
54415         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54416         funding_redeemscript_ref.data = funding_redeemscript->elems;
54417         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54418         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
54419         FREE(funding_redeemscript);
54420         return ret_arr;
54421 }
54422
54423 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) {
54424         LDKBuiltCommitmentTransaction this_arg_conv;
54425         this_arg_conv.inner = untag_ptr(this_arg);
54426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54428         this_arg_conv.is_owned = false;
54429         uint8_t funding_key_arr[32];
54430         CHECK(funding_key->arr_len == 32);
54431         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54432         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54433         LDKu8slice funding_redeemscript_ref;
54434         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54435         funding_redeemscript_ref.data = funding_redeemscript->elems;
54436         void* entropy_source_ptr = untag_ptr(entropy_source);
54437         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54438         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54439         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54440         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);
54441         FREE(funding_redeemscript);
54442         return ret_arr;
54443 }
54444
54445 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
54446         LDKClosingTransaction this_obj_conv;
54447         this_obj_conv.inner = untag_ptr(this_obj);
54448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54450         ClosingTransaction_free(this_obj_conv);
54451 }
54452
54453 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54454         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54455         uint64_t ret_ref = 0;
54456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54458         return ret_ref;
54459 }
54460 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
54461         LDKClosingTransaction arg_conv;
54462         arg_conv.inner = untag_ptr(arg);
54463         arg_conv.is_owned = ptr_is_owned(arg);
54464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54465         arg_conv.is_owned = false;
54466         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54467         return ret_conv;
54468 }
54469
54470 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
54471         LDKClosingTransaction orig_conv;
54472         orig_conv.inner = untag_ptr(orig);
54473         orig_conv.is_owned = ptr_is_owned(orig);
54474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54475         orig_conv.is_owned = false;
54476         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_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 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
54484         LDKClosingTransaction o_conv;
54485         o_conv.inner = untag_ptr(o);
54486         o_conv.is_owned = ptr_is_owned(o);
54487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54488         o_conv.is_owned = false;
54489         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54490         return ret_conv;
54491 }
54492
54493 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
54494         LDKClosingTransaction a_conv;
54495         a_conv.inner = untag_ptr(a);
54496         a_conv.is_owned = ptr_is_owned(a);
54497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54498         a_conv.is_owned = false;
54499         LDKClosingTransaction b_conv;
54500         b_conv.inner = untag_ptr(b);
54501         b_conv.is_owned = ptr_is_owned(b);
54502         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54503         b_conv.is_owned = false;
54504         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54505         return ret_conv;
54506 }
54507
54508 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) {
54509         LDKCVec_u8Z to_holder_script_ref;
54510         to_holder_script_ref.datalen = to_holder_script->arr_len;
54511         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54512         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
54513         LDKCVec_u8Z to_counterparty_script_ref;
54514         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
54515         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54516         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
54517         LDKOutPoint funding_outpoint_conv;
54518         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54519         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54520         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54521         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54522         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54523         uint64_t ret_ref = 0;
54524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54526         return ret_ref;
54527 }
54528
54529 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
54530         LDKClosingTransaction this_arg_conv;
54531         this_arg_conv.inner = untag_ptr(this_arg);
54532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54534         this_arg_conv.is_owned = false;
54535         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54536         uint64_t ret_ref = 0;
54537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54539         return ret_ref;
54540 }
54541
54542 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
54543         LDKClosingTransaction this_arg_conv;
54544         this_arg_conv.inner = untag_ptr(this_arg);
54545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54547         this_arg_conv.is_owned = false;
54548         LDKOutPoint funding_outpoint_conv;
54549         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54550         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54551         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54552         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54553         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54554         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54555         return tag_ptr(ret_conv, true);
54556 }
54557
54558 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
54559         LDKClosingTransaction this_arg_conv;
54560         this_arg_conv.inner = untag_ptr(this_arg);
54561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54563         this_arg_conv.is_owned = false;
54564         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54565         return ret_conv;
54566 }
54567
54568 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
54569         LDKClosingTransaction this_arg_conv;
54570         this_arg_conv.inner = untag_ptr(this_arg);
54571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54573         this_arg_conv.is_owned = false;
54574         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54575         return ret_conv;
54576 }
54577
54578 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
54579         LDKClosingTransaction this_arg_conv;
54580         this_arg_conv.inner = untag_ptr(this_arg);
54581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54583         this_arg_conv.is_owned = false;
54584         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54585         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54586         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54587         return ret_arr;
54588 }
54589
54590 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
54591         LDKClosingTransaction this_arg_conv;
54592         this_arg_conv.inner = untag_ptr(this_arg);
54593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54595         this_arg_conv.is_owned = false;
54596         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54597         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54598         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54599         return ret_arr;
54600 }
54601
54602 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
54603         LDKTrustedClosingTransaction this_obj_conv;
54604         this_obj_conv.inner = untag_ptr(this_obj);
54605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54607         TrustedClosingTransaction_free(this_obj_conv);
54608 }
54609
54610 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
54611         LDKTrustedClosingTransaction this_arg_conv;
54612         this_arg_conv.inner = untag_ptr(this_arg);
54613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54615         this_arg_conv.is_owned = false;
54616         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
54617         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54618         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54619         Transaction_free(ret_var);
54620         return ret_arr;
54621 }
54622
54623 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) {
54624         LDKTrustedClosingTransaction this_arg_conv;
54625         this_arg_conv.inner = untag_ptr(this_arg);
54626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54628         this_arg_conv.is_owned = false;
54629         LDKu8slice funding_redeemscript_ref;
54630         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54631         funding_redeemscript_ref.data = funding_redeemscript->elems;
54632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54633         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
54634         FREE(funding_redeemscript);
54635         return ret_arr;
54636 }
54637
54638 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) {
54639         LDKTrustedClosingTransaction this_arg_conv;
54640         this_arg_conv.inner = untag_ptr(this_arg);
54641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54643         this_arg_conv.is_owned = false;
54644         uint8_t funding_key_arr[32];
54645         CHECK(funding_key->arr_len == 32);
54646         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54647         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54648         LDKu8slice funding_redeemscript_ref;
54649         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54650         funding_redeemscript_ref.data = funding_redeemscript->elems;
54651         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54652         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
54653         FREE(funding_redeemscript);
54654         return ret_arr;
54655 }
54656
54657 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
54658         LDKCommitmentTransaction this_obj_conv;
54659         this_obj_conv.inner = untag_ptr(this_obj);
54660         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54662         CommitmentTransaction_free(this_obj_conv);
54663 }
54664
54665 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
54666         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
54667         uint64_t ret_ref = 0;
54668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54670         return ret_ref;
54671 }
54672 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
54673         LDKCommitmentTransaction arg_conv;
54674         arg_conv.inner = untag_ptr(arg);
54675         arg_conv.is_owned = ptr_is_owned(arg);
54676         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54677         arg_conv.is_owned = false;
54678         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
54679         return ret_conv;
54680 }
54681
54682 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
54683         LDKCommitmentTransaction orig_conv;
54684         orig_conv.inner = untag_ptr(orig);
54685         orig_conv.is_owned = ptr_is_owned(orig);
54686         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54687         orig_conv.is_owned = false;
54688         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
54689         uint64_t ret_ref = 0;
54690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54692         return ret_ref;
54693 }
54694
54695 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
54696         LDKCommitmentTransaction obj_conv;
54697         obj_conv.inner = untag_ptr(obj);
54698         obj_conv.is_owned = ptr_is_owned(obj);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54700         obj_conv.is_owned = false;
54701         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
54702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54704         CVec_u8Z_free(ret_var);
54705         return ret_arr;
54706 }
54707
54708 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
54709         LDKu8slice ser_ref;
54710         ser_ref.datalen = ser->arr_len;
54711         ser_ref.data = ser->elems;
54712         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
54713         *ret_conv = CommitmentTransaction_read(ser_ref);
54714         FREE(ser);
54715         return tag_ptr(ret_conv, true);
54716 }
54717
54718 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
54719         LDKCommitmentTransaction this_arg_conv;
54720         this_arg_conv.inner = untag_ptr(this_arg);
54721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54723         this_arg_conv.is_owned = false;
54724         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
54725         return ret_conv;
54726 }
54727
54728 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
54729         LDKCommitmentTransaction this_arg_conv;
54730         this_arg_conv.inner = untag_ptr(this_arg);
54731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54733         this_arg_conv.is_owned = false;
54734         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54735         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
54736         return ret_arr;
54737 }
54738
54739 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
54740         LDKCommitmentTransaction this_arg_conv;
54741         this_arg_conv.inner = untag_ptr(this_arg);
54742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54744         this_arg_conv.is_owned = false;
54745         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
54746         return ret_conv;
54747 }
54748
54749 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
54750         LDKCommitmentTransaction this_arg_conv;
54751         this_arg_conv.inner = untag_ptr(this_arg);
54752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54754         this_arg_conv.is_owned = false;
54755         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
54756         return ret_conv;
54757 }
54758
54759 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
54760         LDKCommitmentTransaction this_arg_conv;
54761         this_arg_conv.inner = untag_ptr(this_arg);
54762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54764         this_arg_conv.is_owned = false;
54765         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
54766         return ret_conv;
54767 }
54768
54769 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
54770         LDKCommitmentTransaction this_arg_conv;
54771         this_arg_conv.inner = untag_ptr(this_arg);
54772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54774         this_arg_conv.is_owned = false;
54775         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
54776         uint64_t ret_ref = 0;
54777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54779         return ret_ref;
54780 }
54781
54782 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) {
54783         LDKCommitmentTransaction this_arg_conv;
54784         this_arg_conv.inner = untag_ptr(this_arg);
54785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54787         this_arg_conv.is_owned = false;
54788         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54789         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54790         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54791         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54792         channel_parameters_conv.is_owned = false;
54793         LDKChannelPublicKeys broadcaster_keys_conv;
54794         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
54795         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
54796         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
54797         broadcaster_keys_conv.is_owned = false;
54798         LDKChannelPublicKeys countersignatory_keys_conv;
54799         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
54800         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
54801         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
54802         countersignatory_keys_conv.is_owned = false;
54803         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
54804         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
54805         return tag_ptr(ret_conv, true);
54806 }
54807
54808 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
54809         LDKTrustedCommitmentTransaction this_obj_conv;
54810         this_obj_conv.inner = untag_ptr(this_obj);
54811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54813         TrustedCommitmentTransaction_free(this_obj_conv);
54814 }
54815
54816 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
54817         LDKTrustedCommitmentTransaction this_arg_conv;
54818         this_arg_conv.inner = untag_ptr(this_arg);
54819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54821         this_arg_conv.is_owned = false;
54822         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54823         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
54824         return ret_arr;
54825 }
54826
54827 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
54828         LDKTrustedCommitmentTransaction this_arg_conv;
54829         this_arg_conv.inner = untag_ptr(this_arg);
54830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54832         this_arg_conv.is_owned = false;
54833         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
54834         uint64_t ret_ref = 0;
54835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54837         return ret_ref;
54838 }
54839
54840 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
54841         LDKTrustedCommitmentTransaction this_arg_conv;
54842         this_arg_conv.inner = untag_ptr(this_arg);
54843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54845         this_arg_conv.is_owned = false;
54846         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
54847         uint64_t ret_ref = 0;
54848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54850         return ret_ref;
54851 }
54852
54853 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
54854         LDKTrustedCommitmentTransaction this_arg_conv;
54855         this_arg_conv.inner = untag_ptr(this_arg);
54856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54858         this_arg_conv.is_owned = false;
54859         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
54860         uint64_t ret_ref = 0;
54861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54863         return ret_ref;
54864 }
54865
54866 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) {
54867         LDKTrustedCommitmentTransaction this_arg_conv;
54868         this_arg_conv.inner = untag_ptr(this_arg);
54869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54871         this_arg_conv.is_owned = false;
54872         uint8_t htlc_base_key_arr[32];
54873         CHECK(htlc_base_key->arr_len == 32);
54874         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
54875         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
54876         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54877         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54878         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54879         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54880         channel_parameters_conv.is_owned = false;
54881         void* entropy_source_ptr = untag_ptr(entropy_source);
54882         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54883         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54884         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
54885         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
54886         return tag_ptr(ret_conv, true);
54887 }
54888
54889 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
54890         LDKTrustedCommitmentTransaction this_arg_conv;
54891         this_arg_conv.inner = untag_ptr(this_arg);
54892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54894         this_arg_conv.is_owned = false;
54895         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
54896         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
54897         uint64_t ret_ref = tag_ptr(ret_copy, true);
54898         return ret_ref;
54899 }
54900
54901 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) {
54902         LDKTrustedCommitmentTransaction this_arg_conv;
54903         this_arg_conv.inner = untag_ptr(this_arg);
54904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54906         this_arg_conv.is_owned = false;
54907         LDKCVec_u8Z destination_script_ref;
54908         destination_script_ref.datalen = destination_script->arr_len;
54909         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
54910         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
54911         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
54912         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
54913         return tag_ptr(ret_conv, true);
54914 }
54915
54916 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) {
54917         LDKPublicKey broadcaster_payment_basepoint_ref;
54918         CHECK(broadcaster_payment_basepoint->arr_len == 33);
54919         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
54920         LDKPublicKey countersignatory_payment_basepoint_ref;
54921         CHECK(countersignatory_payment_basepoint->arr_len == 33);
54922         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
54923         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
54924         return ret_conv;
54925 }
54926
54927 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
54928         LDKInitFeatures a_conv;
54929         a_conv.inner = untag_ptr(a);
54930         a_conv.is_owned = ptr_is_owned(a);
54931         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54932         a_conv.is_owned = false;
54933         LDKInitFeatures b_conv;
54934         b_conv.inner = untag_ptr(b);
54935         b_conv.is_owned = ptr_is_owned(b);
54936         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54937         b_conv.is_owned = false;
54938         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
54939         return ret_conv;
54940 }
54941
54942 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
54943         LDKNodeFeatures a_conv;
54944         a_conv.inner = untag_ptr(a);
54945         a_conv.is_owned = ptr_is_owned(a);
54946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54947         a_conv.is_owned = false;
54948         LDKNodeFeatures b_conv;
54949         b_conv.inner = untag_ptr(b);
54950         b_conv.is_owned = ptr_is_owned(b);
54951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54952         b_conv.is_owned = false;
54953         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
54954         return ret_conv;
54955 }
54956
54957 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
54958         LDKChannelFeatures a_conv;
54959         a_conv.inner = untag_ptr(a);
54960         a_conv.is_owned = ptr_is_owned(a);
54961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54962         a_conv.is_owned = false;
54963         LDKChannelFeatures b_conv;
54964         b_conv.inner = untag_ptr(b);
54965         b_conv.is_owned = ptr_is_owned(b);
54966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54967         b_conv.is_owned = false;
54968         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
54969         return ret_conv;
54970 }
54971
54972 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
54973         LDKBolt11InvoiceFeatures a_conv;
54974         a_conv.inner = untag_ptr(a);
54975         a_conv.is_owned = ptr_is_owned(a);
54976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54977         a_conv.is_owned = false;
54978         LDKBolt11InvoiceFeatures b_conv;
54979         b_conv.inner = untag_ptr(b);
54980         b_conv.is_owned = ptr_is_owned(b);
54981         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54982         b_conv.is_owned = false;
54983         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
54984         return ret_conv;
54985 }
54986
54987 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
54988         LDKOfferFeatures a_conv;
54989         a_conv.inner = untag_ptr(a);
54990         a_conv.is_owned = ptr_is_owned(a);
54991         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54992         a_conv.is_owned = false;
54993         LDKOfferFeatures b_conv;
54994         b_conv.inner = untag_ptr(b);
54995         b_conv.is_owned = ptr_is_owned(b);
54996         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54997         b_conv.is_owned = false;
54998         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
54999         return ret_conv;
55000 }
55001
55002 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
55003         LDKInvoiceRequestFeatures a_conv;
55004         a_conv.inner = untag_ptr(a);
55005         a_conv.is_owned = ptr_is_owned(a);
55006         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55007         a_conv.is_owned = false;
55008         LDKInvoiceRequestFeatures b_conv;
55009         b_conv.inner = untag_ptr(b);
55010         b_conv.is_owned = ptr_is_owned(b);
55011         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55012         b_conv.is_owned = false;
55013         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
55014         return ret_conv;
55015 }
55016
55017 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
55018         LDKBolt12InvoiceFeatures a_conv;
55019         a_conv.inner = untag_ptr(a);
55020         a_conv.is_owned = ptr_is_owned(a);
55021         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55022         a_conv.is_owned = false;
55023         LDKBolt12InvoiceFeatures b_conv;
55024         b_conv.inner = untag_ptr(b);
55025         b_conv.is_owned = ptr_is_owned(b);
55026         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55027         b_conv.is_owned = false;
55028         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
55029         return ret_conv;
55030 }
55031
55032 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
55033         LDKBlindedHopFeatures a_conv;
55034         a_conv.inner = untag_ptr(a);
55035         a_conv.is_owned = ptr_is_owned(a);
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55037         a_conv.is_owned = false;
55038         LDKBlindedHopFeatures b_conv;
55039         b_conv.inner = untag_ptr(b);
55040         b_conv.is_owned = ptr_is_owned(b);
55041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55042         b_conv.is_owned = false;
55043         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
55044         return ret_conv;
55045 }
55046
55047 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
55048         LDKChannelTypeFeatures a_conv;
55049         a_conv.inner = untag_ptr(a);
55050         a_conv.is_owned = ptr_is_owned(a);
55051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55052         a_conv.is_owned = false;
55053         LDKChannelTypeFeatures b_conv;
55054         b_conv.inner = untag_ptr(b);
55055         b_conv.is_owned = ptr_is_owned(b);
55056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55057         b_conv.is_owned = false;
55058         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
55059         return ret_conv;
55060 }
55061
55062 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
55063         LDKInitFeatures ret_var = InitFeatures_clone(arg);
55064         uint64_t ret_ref = 0;
55065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55067         return ret_ref;
55068 }
55069 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
55070         LDKInitFeatures arg_conv;
55071         arg_conv.inner = untag_ptr(arg);
55072         arg_conv.is_owned = ptr_is_owned(arg);
55073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55074         arg_conv.is_owned = false;
55075         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
55076         return ret_conv;
55077 }
55078
55079 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
55080         LDKInitFeatures orig_conv;
55081         orig_conv.inner = untag_ptr(orig);
55082         orig_conv.is_owned = ptr_is_owned(orig);
55083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55084         orig_conv.is_owned = false;
55085         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
55086         uint64_t ret_ref = 0;
55087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55089         return ret_ref;
55090 }
55091
55092 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
55093         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
55094         uint64_t ret_ref = 0;
55095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55097         return ret_ref;
55098 }
55099 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
55100         LDKNodeFeatures arg_conv;
55101         arg_conv.inner = untag_ptr(arg);
55102         arg_conv.is_owned = ptr_is_owned(arg);
55103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55104         arg_conv.is_owned = false;
55105         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
55106         return ret_conv;
55107 }
55108
55109 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
55110         LDKNodeFeatures orig_conv;
55111         orig_conv.inner = untag_ptr(orig);
55112         orig_conv.is_owned = ptr_is_owned(orig);
55113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55114         orig_conv.is_owned = false;
55115         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
55116         uint64_t ret_ref = 0;
55117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55119         return ret_ref;
55120 }
55121
55122 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
55123         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
55124         uint64_t ret_ref = 0;
55125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55127         return ret_ref;
55128 }
55129 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
55130         LDKChannelFeatures arg_conv;
55131         arg_conv.inner = untag_ptr(arg);
55132         arg_conv.is_owned = ptr_is_owned(arg);
55133         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55134         arg_conv.is_owned = false;
55135         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
55136         return ret_conv;
55137 }
55138
55139 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
55140         LDKChannelFeatures orig_conv;
55141         orig_conv.inner = untag_ptr(orig);
55142         orig_conv.is_owned = ptr_is_owned(orig);
55143         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55144         orig_conv.is_owned = false;
55145         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
55146         uint64_t ret_ref = 0;
55147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55149         return ret_ref;
55150 }
55151
55152 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
55153         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
55154         uint64_t ret_ref = 0;
55155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55157         return ret_ref;
55158 }
55159 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
55160         LDKBolt11InvoiceFeatures arg_conv;
55161         arg_conv.inner = untag_ptr(arg);
55162         arg_conv.is_owned = ptr_is_owned(arg);
55163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55164         arg_conv.is_owned = false;
55165         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
55166         return ret_conv;
55167 }
55168
55169 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
55170         LDKBolt11InvoiceFeatures orig_conv;
55171         orig_conv.inner = untag_ptr(orig);
55172         orig_conv.is_owned = ptr_is_owned(orig);
55173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55174         orig_conv.is_owned = false;
55175         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
55176         uint64_t ret_ref = 0;
55177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55179         return ret_ref;
55180 }
55181
55182 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
55183         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
55184         uint64_t ret_ref = 0;
55185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55187         return ret_ref;
55188 }
55189 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
55190         LDKOfferFeatures arg_conv;
55191         arg_conv.inner = untag_ptr(arg);
55192         arg_conv.is_owned = ptr_is_owned(arg);
55193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55194         arg_conv.is_owned = false;
55195         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
55196         return ret_conv;
55197 }
55198
55199 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
55200         LDKOfferFeatures orig_conv;
55201         orig_conv.inner = untag_ptr(orig);
55202         orig_conv.is_owned = ptr_is_owned(orig);
55203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55204         orig_conv.is_owned = false;
55205         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
55206         uint64_t ret_ref = 0;
55207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55209         return ret_ref;
55210 }
55211
55212 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
55213         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
55214         uint64_t ret_ref = 0;
55215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55217         return ret_ref;
55218 }
55219 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
55220         LDKInvoiceRequestFeatures arg_conv;
55221         arg_conv.inner = untag_ptr(arg);
55222         arg_conv.is_owned = ptr_is_owned(arg);
55223         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55224         arg_conv.is_owned = false;
55225         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
55226         return ret_conv;
55227 }
55228
55229 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
55230         LDKInvoiceRequestFeatures orig_conv;
55231         orig_conv.inner = untag_ptr(orig);
55232         orig_conv.is_owned = ptr_is_owned(orig);
55233         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55234         orig_conv.is_owned = false;
55235         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
55236         uint64_t ret_ref = 0;
55237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55239         return ret_ref;
55240 }
55241
55242 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
55243         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
55244         uint64_t ret_ref = 0;
55245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55247         return ret_ref;
55248 }
55249 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
55250         LDKBolt12InvoiceFeatures arg_conv;
55251         arg_conv.inner = untag_ptr(arg);
55252         arg_conv.is_owned = ptr_is_owned(arg);
55253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55254         arg_conv.is_owned = false;
55255         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
55256         return ret_conv;
55257 }
55258
55259 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
55260         LDKBolt12InvoiceFeatures orig_conv;
55261         orig_conv.inner = untag_ptr(orig);
55262         orig_conv.is_owned = ptr_is_owned(orig);
55263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55264         orig_conv.is_owned = false;
55265         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
55266         uint64_t ret_ref = 0;
55267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55269         return ret_ref;
55270 }
55271
55272 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
55273         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
55274         uint64_t ret_ref = 0;
55275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55277         return ret_ref;
55278 }
55279 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
55280         LDKBlindedHopFeatures arg_conv;
55281         arg_conv.inner = untag_ptr(arg);
55282         arg_conv.is_owned = ptr_is_owned(arg);
55283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55284         arg_conv.is_owned = false;
55285         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
55286         return ret_conv;
55287 }
55288
55289 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
55290         LDKBlindedHopFeatures orig_conv;
55291         orig_conv.inner = untag_ptr(orig);
55292         orig_conv.is_owned = ptr_is_owned(orig);
55293         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55294         orig_conv.is_owned = false;
55295         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
55296         uint64_t ret_ref = 0;
55297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55299         return ret_ref;
55300 }
55301
55302 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
55303         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
55304         uint64_t ret_ref = 0;
55305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55307         return ret_ref;
55308 }
55309 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
55310         LDKChannelTypeFeatures arg_conv;
55311         arg_conv.inner = untag_ptr(arg);
55312         arg_conv.is_owned = ptr_is_owned(arg);
55313         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55314         arg_conv.is_owned = false;
55315         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
55316         return ret_conv;
55317 }
55318
55319 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
55320         LDKChannelTypeFeatures orig_conv;
55321         orig_conv.inner = untag_ptr(orig);
55322         orig_conv.is_owned = ptr_is_owned(orig);
55323         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55324         orig_conv.is_owned = false;
55325         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
55326         uint64_t ret_ref = 0;
55327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55329         return ret_ref;
55330 }
55331
55332 int64_t  __attribute__((export_name("TS_InitFeatures_hash"))) TS_InitFeatures_hash(uint64_t o) {
55333         LDKInitFeatures o_conv;
55334         o_conv.inner = untag_ptr(o);
55335         o_conv.is_owned = ptr_is_owned(o);
55336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55337         o_conv.is_owned = false;
55338         int64_t ret_conv = InitFeatures_hash(&o_conv);
55339         return ret_conv;
55340 }
55341
55342 int64_t  __attribute__((export_name("TS_NodeFeatures_hash"))) TS_NodeFeatures_hash(uint64_t o) {
55343         LDKNodeFeatures o_conv;
55344         o_conv.inner = untag_ptr(o);
55345         o_conv.is_owned = ptr_is_owned(o);
55346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55347         o_conv.is_owned = false;
55348         int64_t ret_conv = NodeFeatures_hash(&o_conv);
55349         return ret_conv;
55350 }
55351
55352 int64_t  __attribute__((export_name("TS_ChannelFeatures_hash"))) TS_ChannelFeatures_hash(uint64_t o) {
55353         LDKChannelFeatures o_conv;
55354         o_conv.inner = untag_ptr(o);
55355         o_conv.is_owned = ptr_is_owned(o);
55356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55357         o_conv.is_owned = false;
55358         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
55359         return ret_conv;
55360 }
55361
55362 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_hash"))) TS_Bolt11InvoiceFeatures_hash(uint64_t o) {
55363         LDKBolt11InvoiceFeatures o_conv;
55364         o_conv.inner = untag_ptr(o);
55365         o_conv.is_owned = ptr_is_owned(o);
55366         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55367         o_conv.is_owned = false;
55368         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
55369         return ret_conv;
55370 }
55371
55372 int64_t  __attribute__((export_name("TS_OfferFeatures_hash"))) TS_OfferFeatures_hash(uint64_t o) {
55373         LDKOfferFeatures o_conv;
55374         o_conv.inner = untag_ptr(o);
55375         o_conv.is_owned = ptr_is_owned(o);
55376         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55377         o_conv.is_owned = false;
55378         int64_t ret_conv = OfferFeatures_hash(&o_conv);
55379         return ret_conv;
55380 }
55381
55382 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_hash"))) TS_InvoiceRequestFeatures_hash(uint64_t o) {
55383         LDKInvoiceRequestFeatures o_conv;
55384         o_conv.inner = untag_ptr(o);
55385         o_conv.is_owned = ptr_is_owned(o);
55386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55387         o_conv.is_owned = false;
55388         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
55389         return ret_conv;
55390 }
55391
55392 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_hash"))) TS_Bolt12InvoiceFeatures_hash(uint64_t o) {
55393         LDKBolt12InvoiceFeatures o_conv;
55394         o_conv.inner = untag_ptr(o);
55395         o_conv.is_owned = ptr_is_owned(o);
55396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55397         o_conv.is_owned = false;
55398         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
55399         return ret_conv;
55400 }
55401
55402 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_hash"))) TS_BlindedHopFeatures_hash(uint64_t o) {
55403         LDKBlindedHopFeatures o_conv;
55404         o_conv.inner = untag_ptr(o);
55405         o_conv.is_owned = ptr_is_owned(o);
55406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55407         o_conv.is_owned = false;
55408         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
55409         return ret_conv;
55410 }
55411
55412 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_hash"))) TS_ChannelTypeFeatures_hash(uint64_t o) {
55413         LDKChannelTypeFeatures o_conv;
55414         o_conv.inner = untag_ptr(o);
55415         o_conv.is_owned = ptr_is_owned(o);
55416         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55417         o_conv.is_owned = false;
55418         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
55419         return ret_conv;
55420 }
55421
55422 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
55423         LDKInitFeatures this_obj_conv;
55424         this_obj_conv.inner = untag_ptr(this_obj);
55425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55427         InitFeatures_free(this_obj_conv);
55428 }
55429
55430 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
55431         LDKNodeFeatures this_obj_conv;
55432         this_obj_conv.inner = untag_ptr(this_obj);
55433         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55435         NodeFeatures_free(this_obj_conv);
55436 }
55437
55438 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
55439         LDKChannelFeatures this_obj_conv;
55440         this_obj_conv.inner = untag_ptr(this_obj);
55441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55443         ChannelFeatures_free(this_obj_conv);
55444 }
55445
55446 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
55447         LDKBolt11InvoiceFeatures this_obj_conv;
55448         this_obj_conv.inner = untag_ptr(this_obj);
55449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55451         Bolt11InvoiceFeatures_free(this_obj_conv);
55452 }
55453
55454 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
55455         LDKOfferFeatures this_obj_conv;
55456         this_obj_conv.inner = untag_ptr(this_obj);
55457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55459         OfferFeatures_free(this_obj_conv);
55460 }
55461
55462 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
55463         LDKInvoiceRequestFeatures this_obj_conv;
55464         this_obj_conv.inner = untag_ptr(this_obj);
55465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55467         InvoiceRequestFeatures_free(this_obj_conv);
55468 }
55469
55470 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
55471         LDKBolt12InvoiceFeatures this_obj_conv;
55472         this_obj_conv.inner = untag_ptr(this_obj);
55473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55475         Bolt12InvoiceFeatures_free(this_obj_conv);
55476 }
55477
55478 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
55479         LDKBlindedHopFeatures this_obj_conv;
55480         this_obj_conv.inner = untag_ptr(this_obj);
55481         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55483         BlindedHopFeatures_free(this_obj_conv);
55484 }
55485
55486 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
55487         LDKChannelTypeFeatures this_obj_conv;
55488         this_obj_conv.inner = untag_ptr(this_obj);
55489         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55491         ChannelTypeFeatures_free(this_obj_conv);
55492 }
55493
55494 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
55495         LDKInitFeatures ret_var = InitFeatures_empty();
55496         uint64_t ret_ref = 0;
55497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55499         return ret_ref;
55500 }
55501
55502 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55503         LDKInitFeatures this_arg_conv;
55504         this_arg_conv.inner = untag_ptr(this_arg);
55505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55507         this_arg_conv.is_owned = false;
55508         LDKInitFeatures other_conv;
55509         other_conv.inner = untag_ptr(other);
55510         other_conv.is_owned = ptr_is_owned(other);
55511         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55512         other_conv.is_owned = false;
55513         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55514         return ret_conv;
55515 }
55516
55517 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
55518         LDKInitFeatures this_arg_conv;
55519         this_arg_conv.inner = untag_ptr(this_arg);
55520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55522         this_arg_conv.is_owned = false;
55523         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
55524         return ret_conv;
55525 }
55526
55527 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55528         LDKInitFeatures this_arg_conv;
55529         this_arg_conv.inner = untag_ptr(this_arg);
55530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55532         this_arg_conv.is_owned = false;
55533         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55534         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
55535         return tag_ptr(ret_conv, true);
55536 }
55537
55538 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55539         LDKInitFeatures this_arg_conv;
55540         this_arg_conv.inner = untag_ptr(this_arg);
55541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55543         this_arg_conv.is_owned = false;
55544         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55545         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55546         return tag_ptr(ret_conv, true);
55547 }
55548
55549 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55550         LDKInitFeatures this_arg_conv;
55551         this_arg_conv.inner = untag_ptr(this_arg);
55552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55554         this_arg_conv.is_owned = false;
55555         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55556         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55557         return tag_ptr(ret_conv, true);
55558 }
55559
55560 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55561         LDKInitFeatures this_arg_conv;
55562         this_arg_conv.inner = untag_ptr(this_arg);
55563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55565         this_arg_conv.is_owned = false;
55566         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55567         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55568         return tag_ptr(ret_conv, true);
55569 }
55570
55571 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
55572         LDKNodeFeatures ret_var = NodeFeatures_empty();
55573         uint64_t ret_ref = 0;
55574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55576         return ret_ref;
55577 }
55578
55579 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55580         LDKNodeFeatures 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         LDKNodeFeatures other_conv;
55586         other_conv.inner = untag_ptr(other);
55587         other_conv.is_owned = ptr_is_owned(other);
55588         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55589         other_conv.is_owned = false;
55590         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55591         return ret_conv;
55592 }
55593
55594 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
55595         LDKNodeFeatures this_arg_conv;
55596         this_arg_conv.inner = untag_ptr(this_arg);
55597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55599         this_arg_conv.is_owned = false;
55600         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55601         return ret_conv;
55602 }
55603
55604 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55605         LDKNodeFeatures this_arg_conv;
55606         this_arg_conv.inner = untag_ptr(this_arg);
55607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55609         this_arg_conv.is_owned = false;
55610         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55611         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55612         return tag_ptr(ret_conv, true);
55613 }
55614
55615 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55616         LDKNodeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55622         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55623         return tag_ptr(ret_conv, true);
55624 }
55625
55626 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55627         LDKNodeFeatures this_arg_conv;
55628         this_arg_conv.inner = untag_ptr(this_arg);
55629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55631         this_arg_conv.is_owned = false;
55632         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55633         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55634         return tag_ptr(ret_conv, true);
55635 }
55636
55637 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55638         LDKNodeFeatures this_arg_conv;
55639         this_arg_conv.inner = untag_ptr(this_arg);
55640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55642         this_arg_conv.is_owned = false;
55643         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55644         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55645         return tag_ptr(ret_conv, true);
55646 }
55647
55648 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
55649         LDKChannelFeatures ret_var = ChannelFeatures_empty();
55650         uint64_t ret_ref = 0;
55651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55653         return ret_ref;
55654 }
55655
55656 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55657         LDKChannelFeatures this_arg_conv;
55658         this_arg_conv.inner = untag_ptr(this_arg);
55659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55661         this_arg_conv.is_owned = false;
55662         LDKChannelFeatures other_conv;
55663         other_conv.inner = untag_ptr(other);
55664         other_conv.is_owned = ptr_is_owned(other);
55665         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55666         other_conv.is_owned = false;
55667         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55668         return ret_conv;
55669 }
55670
55671 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
55672         LDKChannelFeatures this_arg_conv;
55673         this_arg_conv.inner = untag_ptr(this_arg);
55674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55676         this_arg_conv.is_owned = false;
55677         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
55678         return ret_conv;
55679 }
55680
55681 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55682         LDKChannelFeatures this_arg_conv;
55683         this_arg_conv.inner = untag_ptr(this_arg);
55684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55686         this_arg_conv.is_owned = false;
55687         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55688         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
55689         return tag_ptr(ret_conv, true);
55690 }
55691
55692 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55693         LDKChannelFeatures this_arg_conv;
55694         this_arg_conv.inner = untag_ptr(this_arg);
55695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55697         this_arg_conv.is_owned = false;
55698         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55699         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55700         return tag_ptr(ret_conv, true);
55701 }
55702
55703 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55704         LDKChannelFeatures this_arg_conv;
55705         this_arg_conv.inner = untag_ptr(this_arg);
55706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55708         this_arg_conv.is_owned = false;
55709         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55710         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
55711         return tag_ptr(ret_conv, true);
55712 }
55713
55714 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55715         LDKChannelFeatures this_arg_conv;
55716         this_arg_conv.inner = untag_ptr(this_arg);
55717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55719         this_arg_conv.is_owned = false;
55720         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55721         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55722         return tag_ptr(ret_conv, true);
55723 }
55724
55725 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
55726         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
55727         uint64_t ret_ref = 0;
55728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55730         return ret_ref;
55731 }
55732
55733 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55734         LDKBolt11InvoiceFeatures this_arg_conv;
55735         this_arg_conv.inner = untag_ptr(this_arg);
55736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55738         this_arg_conv.is_owned = false;
55739         LDKBolt11InvoiceFeatures other_conv;
55740         other_conv.inner = untag_ptr(other);
55741         other_conv.is_owned = ptr_is_owned(other);
55742         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55743         other_conv.is_owned = false;
55744         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55745         return ret_conv;
55746 }
55747
55748 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
55749         LDKBolt11InvoiceFeatures this_arg_conv;
55750         this_arg_conv.inner = untag_ptr(this_arg);
55751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55753         this_arg_conv.is_owned = false;
55754         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55755         return ret_conv;
55756 }
55757
55758 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55759         LDKBolt11InvoiceFeatures this_arg_conv;
55760         this_arg_conv.inner = untag_ptr(this_arg);
55761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55763         this_arg_conv.is_owned = false;
55764         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55765         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55766         return tag_ptr(ret_conv, true);
55767 }
55768
55769 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55770         LDKBolt11InvoiceFeatures this_arg_conv;
55771         this_arg_conv.inner = untag_ptr(this_arg);
55772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55774         this_arg_conv.is_owned = false;
55775         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55776         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55777         return tag_ptr(ret_conv, true);
55778 }
55779
55780 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55781         LDKBolt11InvoiceFeatures this_arg_conv;
55782         this_arg_conv.inner = untag_ptr(this_arg);
55783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55785         this_arg_conv.is_owned = false;
55786         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55787         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55788         return tag_ptr(ret_conv, true);
55789 }
55790
55791 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55792         LDKBolt11InvoiceFeatures this_arg_conv;
55793         this_arg_conv.inner = untag_ptr(this_arg);
55794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55796         this_arg_conv.is_owned = false;
55797         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55798         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55799         return tag_ptr(ret_conv, true);
55800 }
55801
55802 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
55803         LDKOfferFeatures ret_var = OfferFeatures_empty();
55804         uint64_t ret_ref = 0;
55805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55807         return ret_ref;
55808 }
55809
55810 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55811         LDKOfferFeatures this_arg_conv;
55812         this_arg_conv.inner = untag_ptr(this_arg);
55813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55815         this_arg_conv.is_owned = false;
55816         LDKOfferFeatures other_conv;
55817         other_conv.inner = untag_ptr(other);
55818         other_conv.is_owned = ptr_is_owned(other);
55819         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55820         other_conv.is_owned = false;
55821         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55822         return ret_conv;
55823 }
55824
55825 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
55826         LDKOfferFeatures this_arg_conv;
55827         this_arg_conv.inner = untag_ptr(this_arg);
55828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55830         this_arg_conv.is_owned = false;
55831         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
55832         return ret_conv;
55833 }
55834
55835 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55836         LDKOfferFeatures this_arg_conv;
55837         this_arg_conv.inner = untag_ptr(this_arg);
55838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55840         this_arg_conv.is_owned = false;
55841         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55842         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
55843         return tag_ptr(ret_conv, true);
55844 }
55845
55846 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55847         LDKOfferFeatures this_arg_conv;
55848         this_arg_conv.inner = untag_ptr(this_arg);
55849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55851         this_arg_conv.is_owned = false;
55852         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55853         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55854         return tag_ptr(ret_conv, true);
55855 }
55856
55857 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55858         LDKOfferFeatures this_arg_conv;
55859         this_arg_conv.inner = untag_ptr(this_arg);
55860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55862         this_arg_conv.is_owned = false;
55863         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55864         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
55865         return tag_ptr(ret_conv, true);
55866 }
55867
55868 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55869         LDKOfferFeatures this_arg_conv;
55870         this_arg_conv.inner = untag_ptr(this_arg);
55871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55873         this_arg_conv.is_owned = false;
55874         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55875         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55876         return tag_ptr(ret_conv, true);
55877 }
55878
55879 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
55880         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
55881         uint64_t ret_ref = 0;
55882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55884         return ret_ref;
55885 }
55886
55887 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55888         LDKInvoiceRequestFeatures this_arg_conv;
55889         this_arg_conv.inner = untag_ptr(this_arg);
55890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55892         this_arg_conv.is_owned = false;
55893         LDKInvoiceRequestFeatures other_conv;
55894         other_conv.inner = untag_ptr(other);
55895         other_conv.is_owned = ptr_is_owned(other);
55896         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55897         other_conv.is_owned = false;
55898         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55899         return ret_conv;
55900 }
55901
55902 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
55903         LDKInvoiceRequestFeatures 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         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
55909         return ret_conv;
55910 }
55911
55912 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55913         LDKInvoiceRequestFeatures this_arg_conv;
55914         this_arg_conv.inner = untag_ptr(this_arg);
55915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55917         this_arg_conv.is_owned = false;
55918         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55919         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
55920         return tag_ptr(ret_conv, true);
55921 }
55922
55923 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55924         LDKInvoiceRequestFeatures this_arg_conv;
55925         this_arg_conv.inner = untag_ptr(this_arg);
55926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55928         this_arg_conv.is_owned = false;
55929         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55930         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55931         return tag_ptr(ret_conv, true);
55932 }
55933
55934 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55935         LDKInvoiceRequestFeatures this_arg_conv;
55936         this_arg_conv.inner = untag_ptr(this_arg);
55937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55939         this_arg_conv.is_owned = false;
55940         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55941         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
55942         return tag_ptr(ret_conv, true);
55943 }
55944
55945 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55946         LDKInvoiceRequestFeatures this_arg_conv;
55947         this_arg_conv.inner = untag_ptr(this_arg);
55948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55950         this_arg_conv.is_owned = false;
55951         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55952         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55953         return tag_ptr(ret_conv, true);
55954 }
55955
55956 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
55957         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
55958         uint64_t ret_ref = 0;
55959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55961         return ret_ref;
55962 }
55963
55964 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55965         LDKBolt12InvoiceFeatures this_arg_conv;
55966         this_arg_conv.inner = untag_ptr(this_arg);
55967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55969         this_arg_conv.is_owned = false;
55970         LDKBolt12InvoiceFeatures other_conv;
55971         other_conv.inner = untag_ptr(other);
55972         other_conv.is_owned = ptr_is_owned(other);
55973         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55974         other_conv.is_owned = false;
55975         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55976         return ret_conv;
55977 }
55978
55979 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
55980         LDKBolt12InvoiceFeatures this_arg_conv;
55981         this_arg_conv.inner = untag_ptr(this_arg);
55982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55984         this_arg_conv.is_owned = false;
55985         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55986         return ret_conv;
55987 }
55988
55989 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55990         LDKBolt12InvoiceFeatures this_arg_conv;
55991         this_arg_conv.inner = untag_ptr(this_arg);
55992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55994         this_arg_conv.is_owned = false;
55995         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55996         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55997         return tag_ptr(ret_conv, true);
55998 }
55999
56000 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
56001         LDKBolt12InvoiceFeatures this_arg_conv;
56002         this_arg_conv.inner = untag_ptr(this_arg);
56003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56005         this_arg_conv.is_owned = false;
56006         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56007         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56008         return tag_ptr(ret_conv, true);
56009 }
56010
56011 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
56012         LDKBolt12InvoiceFeatures this_arg_conv;
56013         this_arg_conv.inner = untag_ptr(this_arg);
56014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56016         this_arg_conv.is_owned = false;
56017         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56018         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56019         return tag_ptr(ret_conv, true);
56020 }
56021
56022 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
56023         LDKBolt12InvoiceFeatures this_arg_conv;
56024         this_arg_conv.inner = untag_ptr(this_arg);
56025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56027         this_arg_conv.is_owned = false;
56028         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56029         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56030         return tag_ptr(ret_conv, true);
56031 }
56032
56033 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
56034         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
56035         uint64_t ret_ref = 0;
56036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56038         return ret_ref;
56039 }
56040
56041 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
56042         LDKBlindedHopFeatures this_arg_conv;
56043         this_arg_conv.inner = untag_ptr(this_arg);
56044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56046         this_arg_conv.is_owned = false;
56047         LDKBlindedHopFeatures other_conv;
56048         other_conv.inner = untag_ptr(other);
56049         other_conv.is_owned = ptr_is_owned(other);
56050         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56051         other_conv.is_owned = false;
56052         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56053         return ret_conv;
56054 }
56055
56056 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
56057         LDKBlindedHopFeatures this_arg_conv;
56058         this_arg_conv.inner = untag_ptr(this_arg);
56059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56061         this_arg_conv.is_owned = false;
56062         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
56063         return ret_conv;
56064 }
56065
56066 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
56067         LDKBlindedHopFeatures this_arg_conv;
56068         this_arg_conv.inner = untag_ptr(this_arg);
56069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56071         this_arg_conv.is_owned = false;
56072         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56073         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
56074         return tag_ptr(ret_conv, true);
56075 }
56076
56077 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
56078         LDKBlindedHopFeatures this_arg_conv;
56079         this_arg_conv.inner = untag_ptr(this_arg);
56080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56082         this_arg_conv.is_owned = false;
56083         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56084         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56085         return tag_ptr(ret_conv, true);
56086 }
56087
56088 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
56089         LDKBlindedHopFeatures this_arg_conv;
56090         this_arg_conv.inner = untag_ptr(this_arg);
56091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56093         this_arg_conv.is_owned = false;
56094         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56095         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
56096         return tag_ptr(ret_conv, true);
56097 }
56098
56099 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
56100         LDKBlindedHopFeatures this_arg_conv;
56101         this_arg_conv.inner = untag_ptr(this_arg);
56102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56104         this_arg_conv.is_owned = false;
56105         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56106         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56107         return tag_ptr(ret_conv, true);
56108 }
56109
56110 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
56111         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
56112         uint64_t ret_ref = 0;
56113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56115         return ret_ref;
56116 }
56117
56118 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
56119         LDKChannelTypeFeatures this_arg_conv;
56120         this_arg_conv.inner = untag_ptr(this_arg);
56121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56123         this_arg_conv.is_owned = false;
56124         LDKChannelTypeFeatures other_conv;
56125         other_conv.inner = untag_ptr(other);
56126         other_conv.is_owned = ptr_is_owned(other);
56127         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56128         other_conv.is_owned = false;
56129         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56130         return ret_conv;
56131 }
56132
56133 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
56134         LDKChannelTypeFeatures this_arg_conv;
56135         this_arg_conv.inner = untag_ptr(this_arg);
56136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56138         this_arg_conv.is_owned = false;
56139         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
56140         return ret_conv;
56141 }
56142
56143 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
56144         LDKChannelTypeFeatures this_arg_conv;
56145         this_arg_conv.inner = untag_ptr(this_arg);
56146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56148         this_arg_conv.is_owned = false;
56149         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56150         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56151         return tag_ptr(ret_conv, true);
56152 }
56153
56154 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
56155         LDKChannelTypeFeatures this_arg_conv;
56156         this_arg_conv.inner = untag_ptr(this_arg);
56157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56159         this_arg_conv.is_owned = false;
56160         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56161         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56162         return tag_ptr(ret_conv, true);
56163 }
56164
56165 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
56166         LDKChannelTypeFeatures this_arg_conv;
56167         this_arg_conv.inner = untag_ptr(this_arg);
56168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56170         this_arg_conv.is_owned = false;
56171         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56172         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56173         return tag_ptr(ret_conv, true);
56174 }
56175
56176 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
56177         LDKChannelTypeFeatures this_arg_conv;
56178         this_arg_conv.inner = untag_ptr(this_arg);
56179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56181         this_arg_conv.is_owned = false;
56182         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56183         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56184         return tag_ptr(ret_conv, true);
56185 }
56186
56187 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
56188         LDKInitFeatures obj_conv;
56189         obj_conv.inner = untag_ptr(obj);
56190         obj_conv.is_owned = ptr_is_owned(obj);
56191         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56192         obj_conv.is_owned = false;
56193         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
56194         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56195         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56196         CVec_u8Z_free(ret_var);
56197         return ret_arr;
56198 }
56199
56200 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
56201         LDKu8slice ser_ref;
56202         ser_ref.datalen = ser->arr_len;
56203         ser_ref.data = ser->elems;
56204         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
56205         *ret_conv = InitFeatures_read(ser_ref);
56206         FREE(ser);
56207         return tag_ptr(ret_conv, true);
56208 }
56209
56210 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
56211         LDKChannelFeatures obj_conv;
56212         obj_conv.inner = untag_ptr(obj);
56213         obj_conv.is_owned = ptr_is_owned(obj);
56214         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56215         obj_conv.is_owned = false;
56216         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
56217         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56218         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56219         CVec_u8Z_free(ret_var);
56220         return ret_arr;
56221 }
56222
56223 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
56224         LDKu8slice ser_ref;
56225         ser_ref.datalen = ser->arr_len;
56226         ser_ref.data = ser->elems;
56227         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
56228         *ret_conv = ChannelFeatures_read(ser_ref);
56229         FREE(ser);
56230         return tag_ptr(ret_conv, true);
56231 }
56232
56233 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
56234         LDKNodeFeatures obj_conv;
56235         obj_conv.inner = untag_ptr(obj);
56236         obj_conv.is_owned = ptr_is_owned(obj);
56237         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56238         obj_conv.is_owned = false;
56239         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
56240         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56241         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56242         CVec_u8Z_free(ret_var);
56243         return ret_arr;
56244 }
56245
56246 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
56247         LDKu8slice ser_ref;
56248         ser_ref.datalen = ser->arr_len;
56249         ser_ref.data = ser->elems;
56250         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
56251         *ret_conv = NodeFeatures_read(ser_ref);
56252         FREE(ser);
56253         return tag_ptr(ret_conv, true);
56254 }
56255
56256 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
56257         LDKBolt11InvoiceFeatures obj_conv;
56258         obj_conv.inner = untag_ptr(obj);
56259         obj_conv.is_owned = ptr_is_owned(obj);
56260         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56261         obj_conv.is_owned = false;
56262         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
56263         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56264         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56265         CVec_u8Z_free(ret_var);
56266         return ret_arr;
56267 }
56268
56269 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
56270         LDKu8slice ser_ref;
56271         ser_ref.datalen = ser->arr_len;
56272         ser_ref.data = ser->elems;
56273         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
56274         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
56275         FREE(ser);
56276         return tag_ptr(ret_conv, true);
56277 }
56278
56279 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
56280         LDKBolt12InvoiceFeatures obj_conv;
56281         obj_conv.inner = untag_ptr(obj);
56282         obj_conv.is_owned = ptr_is_owned(obj);
56283         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56284         obj_conv.is_owned = false;
56285         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
56286         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56287         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56288         CVec_u8Z_free(ret_var);
56289         return ret_arr;
56290 }
56291
56292 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
56293         LDKu8slice ser_ref;
56294         ser_ref.datalen = ser->arr_len;
56295         ser_ref.data = ser->elems;
56296         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
56297         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
56298         FREE(ser);
56299         return tag_ptr(ret_conv, true);
56300 }
56301
56302 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
56303         LDKBlindedHopFeatures obj_conv;
56304         obj_conv.inner = untag_ptr(obj);
56305         obj_conv.is_owned = ptr_is_owned(obj);
56306         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56307         obj_conv.is_owned = false;
56308         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
56309         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56310         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56311         CVec_u8Z_free(ret_var);
56312         return ret_arr;
56313 }
56314
56315 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
56316         LDKu8slice ser_ref;
56317         ser_ref.datalen = ser->arr_len;
56318         ser_ref.data = ser->elems;
56319         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
56320         *ret_conv = BlindedHopFeatures_read(ser_ref);
56321         FREE(ser);
56322         return tag_ptr(ret_conv, true);
56323 }
56324
56325 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
56326         LDKChannelTypeFeatures obj_conv;
56327         obj_conv.inner = untag_ptr(obj);
56328         obj_conv.is_owned = ptr_is_owned(obj);
56329         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56330         obj_conv.is_owned = false;
56331         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
56332         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56333         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56334         CVec_u8Z_free(ret_var);
56335         return ret_arr;
56336 }
56337
56338 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
56339         LDKu8slice ser_ref;
56340         ser_ref.datalen = ser->arr_len;
56341         ser_ref.data = ser->elems;
56342         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
56343         *ret_conv = ChannelTypeFeatures_read(ser_ref);
56344         FREE(ser);
56345         return tag_ptr(ret_conv, true);
56346 }
56347
56348 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
56349         LDKInitFeatures this_arg_conv;
56350         this_arg_conv.inner = untag_ptr(this_arg);
56351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56353         this_arg_conv.is_owned = false;
56354         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
56355 }
56356
56357 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
56358         LDKInitFeatures this_arg_conv;
56359         this_arg_conv.inner = untag_ptr(this_arg);
56360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56362         this_arg_conv.is_owned = false;
56363         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
56364 }
56365
56366 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
56367         LDKInitFeatures this_arg_conv;
56368         this_arg_conv.inner = untag_ptr(this_arg);
56369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56371         this_arg_conv.is_owned = false;
56372         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
56373         return ret_conv;
56374 }
56375
56376 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
56377         LDKNodeFeatures this_arg_conv;
56378         this_arg_conv.inner = untag_ptr(this_arg);
56379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56381         this_arg_conv.is_owned = false;
56382         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
56383 }
56384
56385 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
56386         LDKNodeFeatures this_arg_conv;
56387         this_arg_conv.inner = untag_ptr(this_arg);
56388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56390         this_arg_conv.is_owned = false;
56391         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
56392 }
56393
56394 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
56395         LDKNodeFeatures this_arg_conv;
56396         this_arg_conv.inner = untag_ptr(this_arg);
56397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56399         this_arg_conv.is_owned = false;
56400         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
56401         return ret_conv;
56402 }
56403
56404 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
56405         LDKInitFeatures this_arg_conv;
56406         this_arg_conv.inner = untag_ptr(this_arg);
56407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56409         this_arg_conv.is_owned = false;
56410         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
56411         return ret_conv;
56412 }
56413
56414 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
56415         LDKNodeFeatures this_arg_conv;
56416         this_arg_conv.inner = untag_ptr(this_arg);
56417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56419         this_arg_conv.is_owned = false;
56420         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
56421         return ret_conv;
56422 }
56423
56424 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
56425         LDKInitFeatures this_arg_conv;
56426         this_arg_conv.inner = untag_ptr(this_arg);
56427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56429         this_arg_conv.is_owned = false;
56430         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
56431 }
56432
56433 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
56434         LDKInitFeatures this_arg_conv;
56435         this_arg_conv.inner = untag_ptr(this_arg);
56436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56438         this_arg_conv.is_owned = false;
56439         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
56440 }
56441
56442 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
56443         LDKInitFeatures this_arg_conv;
56444         this_arg_conv.inner = untag_ptr(this_arg);
56445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56447         this_arg_conv.is_owned = false;
56448         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
56449         return ret_conv;
56450 }
56451
56452 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
56453         LDKInitFeatures this_arg_conv;
56454         this_arg_conv.inner = untag_ptr(this_arg);
56455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56457         this_arg_conv.is_owned = false;
56458         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56459 }
56460
56461 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
56462         LDKInitFeatures this_arg_conv;
56463         this_arg_conv.inner = untag_ptr(this_arg);
56464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56466         this_arg_conv.is_owned = false;
56467         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56468 }
56469
56470 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
56471         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56477         return ret_conv;
56478 }
56479
56480 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
56481         LDKNodeFeatures this_arg_conv;
56482         this_arg_conv.inner = untag_ptr(this_arg);
56483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56485         this_arg_conv.is_owned = false;
56486         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56487 }
56488
56489 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
56490         LDKNodeFeatures this_arg_conv;
56491         this_arg_conv.inner = untag_ptr(this_arg);
56492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56494         this_arg_conv.is_owned = false;
56495         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56496 }
56497
56498 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
56499         LDKNodeFeatures this_arg_conv;
56500         this_arg_conv.inner = untag_ptr(this_arg);
56501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56503         this_arg_conv.is_owned = false;
56504         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56505         return ret_conv;
56506 }
56507
56508 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
56509         LDKInitFeatures this_arg_conv;
56510         this_arg_conv.inner = untag_ptr(this_arg);
56511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56513         this_arg_conv.is_owned = false;
56514         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56515         return ret_conv;
56516 }
56517
56518 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
56519         LDKNodeFeatures this_arg_conv;
56520         this_arg_conv.inner = untag_ptr(this_arg);
56521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56523         this_arg_conv.is_owned = false;
56524         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56525         return ret_conv;
56526 }
56527
56528 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
56529         LDKInitFeatures this_arg_conv;
56530         this_arg_conv.inner = untag_ptr(this_arg);
56531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56533         this_arg_conv.is_owned = false;
56534         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
56535 }
56536
56537 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
56538         LDKInitFeatures this_arg_conv;
56539         this_arg_conv.inner = untag_ptr(this_arg);
56540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56542         this_arg_conv.is_owned = false;
56543         InitFeatures_set_gossip_queries_required(&this_arg_conv);
56544 }
56545
56546 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
56547         LDKInitFeatures this_arg_conv;
56548         this_arg_conv.inner = untag_ptr(this_arg);
56549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56551         this_arg_conv.is_owned = false;
56552         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56553         return ret_conv;
56554 }
56555
56556 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
56557         LDKNodeFeatures this_arg_conv;
56558         this_arg_conv.inner = untag_ptr(this_arg);
56559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56561         this_arg_conv.is_owned = false;
56562         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56563 }
56564
56565 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
56566         LDKNodeFeatures this_arg_conv;
56567         this_arg_conv.inner = untag_ptr(this_arg);
56568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56570         this_arg_conv.is_owned = false;
56571         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56572 }
56573
56574 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
56575         LDKNodeFeatures this_arg_conv;
56576         this_arg_conv.inner = untag_ptr(this_arg);
56577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56579         this_arg_conv.is_owned = false;
56580         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56581         return ret_conv;
56582 }
56583
56584 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
56585         LDKInitFeatures this_arg_conv;
56586         this_arg_conv.inner = untag_ptr(this_arg);
56587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56589         this_arg_conv.is_owned = false;
56590         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56591         return ret_conv;
56592 }
56593
56594 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
56595         LDKNodeFeatures this_arg_conv;
56596         this_arg_conv.inner = untag_ptr(this_arg);
56597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56599         this_arg_conv.is_owned = false;
56600         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56601         return ret_conv;
56602 }
56603
56604 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
56605         LDKInitFeatures this_arg_conv;
56606         this_arg_conv.inner = untag_ptr(this_arg);
56607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56609         this_arg_conv.is_owned = false;
56610         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
56611 }
56612
56613 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
56614         LDKInitFeatures this_arg_conv;
56615         this_arg_conv.inner = untag_ptr(this_arg);
56616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56618         this_arg_conv.is_owned = false;
56619         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
56620 }
56621
56622 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
56623         LDKInitFeatures this_arg_conv;
56624         this_arg_conv.inner = untag_ptr(this_arg);
56625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56627         this_arg_conv.is_owned = false;
56628         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
56629         return ret_conv;
56630 }
56631
56632 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
56633         LDKNodeFeatures this_arg_conv;
56634         this_arg_conv.inner = untag_ptr(this_arg);
56635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56637         this_arg_conv.is_owned = false;
56638         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
56639 }
56640
56641 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
56642         LDKNodeFeatures this_arg_conv;
56643         this_arg_conv.inner = untag_ptr(this_arg);
56644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56646         this_arg_conv.is_owned = false;
56647         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
56648 }
56649
56650 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
56651         LDKNodeFeatures this_arg_conv;
56652         this_arg_conv.inner = untag_ptr(this_arg);
56653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56655         this_arg_conv.is_owned = false;
56656         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
56657         return ret_conv;
56658 }
56659
56660 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
56661         LDKBolt11InvoiceFeatures this_arg_conv;
56662         this_arg_conv.inner = untag_ptr(this_arg);
56663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56665         this_arg_conv.is_owned = false;
56666         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
56667 }
56668
56669 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
56670         LDKBolt11InvoiceFeatures this_arg_conv;
56671         this_arg_conv.inner = untag_ptr(this_arg);
56672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56674         this_arg_conv.is_owned = false;
56675         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
56676 }
56677
56678 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
56679         LDKBolt11InvoiceFeatures this_arg_conv;
56680         this_arg_conv.inner = untag_ptr(this_arg);
56681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56683         this_arg_conv.is_owned = false;
56684         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
56685         return ret_conv;
56686 }
56687
56688 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
56689         LDKInitFeatures this_arg_conv;
56690         this_arg_conv.inner = untag_ptr(this_arg);
56691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56693         this_arg_conv.is_owned = false;
56694         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
56695         return ret_conv;
56696 }
56697
56698 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
56699         LDKNodeFeatures this_arg_conv;
56700         this_arg_conv.inner = untag_ptr(this_arg);
56701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56703         this_arg_conv.is_owned = false;
56704         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
56705         return ret_conv;
56706 }
56707
56708 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
56709         LDKBolt11InvoiceFeatures this_arg_conv;
56710         this_arg_conv.inner = untag_ptr(this_arg);
56711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56713         this_arg_conv.is_owned = false;
56714         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
56715         return ret_conv;
56716 }
56717
56718 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
56719         LDKInitFeatures this_arg_conv;
56720         this_arg_conv.inner = untag_ptr(this_arg);
56721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56723         this_arg_conv.is_owned = false;
56724         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
56725 }
56726
56727 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
56728         LDKInitFeatures this_arg_conv;
56729         this_arg_conv.inner = untag_ptr(this_arg);
56730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56732         this_arg_conv.is_owned = false;
56733         InitFeatures_set_static_remote_key_required(&this_arg_conv);
56734 }
56735
56736 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
56737         LDKInitFeatures this_arg_conv;
56738         this_arg_conv.inner = untag_ptr(this_arg);
56739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56741         this_arg_conv.is_owned = false;
56742         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
56743         return ret_conv;
56744 }
56745
56746 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
56747         LDKNodeFeatures this_arg_conv;
56748         this_arg_conv.inner = untag_ptr(this_arg);
56749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56751         this_arg_conv.is_owned = false;
56752         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
56753 }
56754
56755 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
56756         LDKNodeFeatures this_arg_conv;
56757         this_arg_conv.inner = untag_ptr(this_arg);
56758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56760         this_arg_conv.is_owned = false;
56761         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
56762 }
56763
56764 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
56765         LDKNodeFeatures this_arg_conv;
56766         this_arg_conv.inner = untag_ptr(this_arg);
56767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56769         this_arg_conv.is_owned = false;
56770         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
56771         return ret_conv;
56772 }
56773
56774 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
56775         LDKChannelTypeFeatures this_arg_conv;
56776         this_arg_conv.inner = untag_ptr(this_arg);
56777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56779         this_arg_conv.is_owned = false;
56780         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
56781 }
56782
56783 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
56784         LDKChannelTypeFeatures this_arg_conv;
56785         this_arg_conv.inner = untag_ptr(this_arg);
56786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56788         this_arg_conv.is_owned = false;
56789         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
56790 }
56791
56792 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
56793         LDKChannelTypeFeatures this_arg_conv;
56794         this_arg_conv.inner = untag_ptr(this_arg);
56795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56797         this_arg_conv.is_owned = false;
56798         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
56799         return ret_conv;
56800 }
56801
56802 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
56803         LDKInitFeatures this_arg_conv;
56804         this_arg_conv.inner = untag_ptr(this_arg);
56805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56807         this_arg_conv.is_owned = false;
56808         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
56809         return ret_conv;
56810 }
56811
56812 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
56813         LDKNodeFeatures this_arg_conv;
56814         this_arg_conv.inner = untag_ptr(this_arg);
56815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56817         this_arg_conv.is_owned = false;
56818         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
56819         return ret_conv;
56820 }
56821
56822 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
56823         LDKChannelTypeFeatures this_arg_conv;
56824         this_arg_conv.inner = untag_ptr(this_arg);
56825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56827         this_arg_conv.is_owned = false;
56828         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
56829         return ret_conv;
56830 }
56831
56832 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
56833         LDKInitFeatures this_arg_conv;
56834         this_arg_conv.inner = untag_ptr(this_arg);
56835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56837         this_arg_conv.is_owned = false;
56838         InitFeatures_set_payment_secret_optional(&this_arg_conv);
56839 }
56840
56841 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
56842         LDKInitFeatures this_arg_conv;
56843         this_arg_conv.inner = untag_ptr(this_arg);
56844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56846         this_arg_conv.is_owned = false;
56847         InitFeatures_set_payment_secret_required(&this_arg_conv);
56848 }
56849
56850 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
56851         LDKInitFeatures this_arg_conv;
56852         this_arg_conv.inner = untag_ptr(this_arg);
56853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56855         this_arg_conv.is_owned = false;
56856         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
56857         return ret_conv;
56858 }
56859
56860 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
56861         LDKNodeFeatures this_arg_conv;
56862         this_arg_conv.inner = untag_ptr(this_arg);
56863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56865         this_arg_conv.is_owned = false;
56866         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
56867 }
56868
56869 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
56870         LDKNodeFeatures this_arg_conv;
56871         this_arg_conv.inner = untag_ptr(this_arg);
56872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56874         this_arg_conv.is_owned = false;
56875         NodeFeatures_set_payment_secret_required(&this_arg_conv);
56876 }
56877
56878 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
56879         LDKNodeFeatures this_arg_conv;
56880         this_arg_conv.inner = untag_ptr(this_arg);
56881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56883         this_arg_conv.is_owned = false;
56884         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
56885         return ret_conv;
56886 }
56887
56888 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
56889         LDKBolt11InvoiceFeatures this_arg_conv;
56890         this_arg_conv.inner = untag_ptr(this_arg);
56891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56893         this_arg_conv.is_owned = false;
56894         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
56895 }
56896
56897 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
56898         LDKBolt11InvoiceFeatures this_arg_conv;
56899         this_arg_conv.inner = untag_ptr(this_arg);
56900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56902         this_arg_conv.is_owned = false;
56903         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
56904 }
56905
56906 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
56907         LDKBolt11InvoiceFeatures this_arg_conv;
56908         this_arg_conv.inner = untag_ptr(this_arg);
56909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56911         this_arg_conv.is_owned = false;
56912         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
56913         return ret_conv;
56914 }
56915
56916 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
56917         LDKInitFeatures this_arg_conv;
56918         this_arg_conv.inner = untag_ptr(this_arg);
56919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56921         this_arg_conv.is_owned = false;
56922         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
56923         return ret_conv;
56924 }
56925
56926 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
56927         LDKNodeFeatures this_arg_conv;
56928         this_arg_conv.inner = untag_ptr(this_arg);
56929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56931         this_arg_conv.is_owned = false;
56932         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
56933         return ret_conv;
56934 }
56935
56936 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
56937         LDKBolt11InvoiceFeatures this_arg_conv;
56938         this_arg_conv.inner = untag_ptr(this_arg);
56939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56941         this_arg_conv.is_owned = false;
56942         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
56943         return ret_conv;
56944 }
56945
56946 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
56947         LDKInitFeatures this_arg_conv;
56948         this_arg_conv.inner = untag_ptr(this_arg);
56949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56951         this_arg_conv.is_owned = false;
56952         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
56953 }
56954
56955 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
56956         LDKInitFeatures this_arg_conv;
56957         this_arg_conv.inner = untag_ptr(this_arg);
56958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56960         this_arg_conv.is_owned = false;
56961         InitFeatures_set_basic_mpp_required(&this_arg_conv);
56962 }
56963
56964 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
56965         LDKInitFeatures this_arg_conv;
56966         this_arg_conv.inner = untag_ptr(this_arg);
56967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56969         this_arg_conv.is_owned = false;
56970         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
56971         return ret_conv;
56972 }
56973
56974 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
56975         LDKNodeFeatures this_arg_conv;
56976         this_arg_conv.inner = untag_ptr(this_arg);
56977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56979         this_arg_conv.is_owned = false;
56980         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
56981 }
56982
56983 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
56984         LDKNodeFeatures this_arg_conv;
56985         this_arg_conv.inner = untag_ptr(this_arg);
56986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56988         this_arg_conv.is_owned = false;
56989         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
56990 }
56991
56992 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
56993         LDKNodeFeatures this_arg_conv;
56994         this_arg_conv.inner = untag_ptr(this_arg);
56995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56997         this_arg_conv.is_owned = false;
56998         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
56999         return ret_conv;
57000 }
57001
57002 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
57003         LDKBolt11InvoiceFeatures this_arg_conv;
57004         this_arg_conv.inner = untag_ptr(this_arg);
57005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57007         this_arg_conv.is_owned = false;
57008         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57009 }
57010
57011 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
57012         LDKBolt11InvoiceFeatures this_arg_conv;
57013         this_arg_conv.inner = untag_ptr(this_arg);
57014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57016         this_arg_conv.is_owned = false;
57017         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57018 }
57019
57020 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
57021         LDKBolt11InvoiceFeatures this_arg_conv;
57022         this_arg_conv.inner = untag_ptr(this_arg);
57023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57025         this_arg_conv.is_owned = false;
57026         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57027         return ret_conv;
57028 }
57029
57030 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
57031         LDKBolt12InvoiceFeatures this_arg_conv;
57032         this_arg_conv.inner = untag_ptr(this_arg);
57033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57035         this_arg_conv.is_owned = false;
57036         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57037 }
57038
57039 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
57040         LDKBolt12InvoiceFeatures this_arg_conv;
57041         this_arg_conv.inner = untag_ptr(this_arg);
57042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57044         this_arg_conv.is_owned = false;
57045         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57046 }
57047
57048 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
57049         LDKBolt12InvoiceFeatures this_arg_conv;
57050         this_arg_conv.inner = untag_ptr(this_arg);
57051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57053         this_arg_conv.is_owned = false;
57054         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57055         return ret_conv;
57056 }
57057
57058 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
57059         LDKInitFeatures this_arg_conv;
57060         this_arg_conv.inner = untag_ptr(this_arg);
57061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57063         this_arg_conv.is_owned = false;
57064         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
57065         return ret_conv;
57066 }
57067
57068 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
57069         LDKNodeFeatures this_arg_conv;
57070         this_arg_conv.inner = untag_ptr(this_arg);
57071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57073         this_arg_conv.is_owned = false;
57074         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
57075         return ret_conv;
57076 }
57077
57078 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
57079         LDKBolt11InvoiceFeatures this_arg_conv;
57080         this_arg_conv.inner = untag_ptr(this_arg);
57081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57083         this_arg_conv.is_owned = false;
57084         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57085         return ret_conv;
57086 }
57087
57088 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
57089         LDKBolt12InvoiceFeatures this_arg_conv;
57090         this_arg_conv.inner = untag_ptr(this_arg);
57091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57093         this_arg_conv.is_owned = false;
57094         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57095         return ret_conv;
57096 }
57097
57098 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
57099         LDKInitFeatures this_arg_conv;
57100         this_arg_conv.inner = untag_ptr(this_arg);
57101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57103         this_arg_conv.is_owned = false;
57104         InitFeatures_set_wumbo_optional(&this_arg_conv);
57105 }
57106
57107 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
57108         LDKInitFeatures this_arg_conv;
57109         this_arg_conv.inner = untag_ptr(this_arg);
57110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57112         this_arg_conv.is_owned = false;
57113         InitFeatures_set_wumbo_required(&this_arg_conv);
57114 }
57115
57116 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
57117         LDKInitFeatures this_arg_conv;
57118         this_arg_conv.inner = untag_ptr(this_arg);
57119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57121         this_arg_conv.is_owned = false;
57122         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
57123         return ret_conv;
57124 }
57125
57126 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
57127         LDKNodeFeatures this_arg_conv;
57128         this_arg_conv.inner = untag_ptr(this_arg);
57129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57131         this_arg_conv.is_owned = false;
57132         NodeFeatures_set_wumbo_optional(&this_arg_conv);
57133 }
57134
57135 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
57136         LDKNodeFeatures 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         NodeFeatures_set_wumbo_required(&this_arg_conv);
57142 }
57143
57144 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
57145         LDKNodeFeatures this_arg_conv;
57146         this_arg_conv.inner = untag_ptr(this_arg);
57147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57149         this_arg_conv.is_owned = false;
57150         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
57151         return ret_conv;
57152 }
57153
57154 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
57155         LDKInitFeatures this_arg_conv;
57156         this_arg_conv.inner = untag_ptr(this_arg);
57157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57159         this_arg_conv.is_owned = false;
57160         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
57161         return ret_conv;
57162 }
57163
57164 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
57165         LDKNodeFeatures this_arg_conv;
57166         this_arg_conv.inner = untag_ptr(this_arg);
57167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57169         this_arg_conv.is_owned = false;
57170         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
57171         return ret_conv;
57172 }
57173
57174 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) {
57175         LDKInitFeatures this_arg_conv;
57176         this_arg_conv.inner = untag_ptr(this_arg);
57177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57179         this_arg_conv.is_owned = false;
57180         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57181 }
57182
57183 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) {
57184         LDKInitFeatures this_arg_conv;
57185         this_arg_conv.inner = untag_ptr(this_arg);
57186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57188         this_arg_conv.is_owned = false;
57189         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57190 }
57191
57192 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57193         LDKInitFeatures this_arg_conv;
57194         this_arg_conv.inner = untag_ptr(this_arg);
57195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57197         this_arg_conv.is_owned = false;
57198         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57199         return ret_conv;
57200 }
57201
57202 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) {
57203         LDKNodeFeatures this_arg_conv;
57204         this_arg_conv.inner = untag_ptr(this_arg);
57205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57207         this_arg_conv.is_owned = false;
57208         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57209 }
57210
57211 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) {
57212         LDKNodeFeatures this_arg_conv;
57213         this_arg_conv.inner = untag_ptr(this_arg);
57214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57216         this_arg_conv.is_owned = false;
57217         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57218 }
57219
57220 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57221         LDKNodeFeatures this_arg_conv;
57222         this_arg_conv.inner = untag_ptr(this_arg);
57223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57225         this_arg_conv.is_owned = false;
57226         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57227         return ret_conv;
57228 }
57229
57230 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) {
57231         LDKChannelTypeFeatures this_arg_conv;
57232         this_arg_conv.inner = untag_ptr(this_arg);
57233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57235         this_arg_conv.is_owned = false;
57236         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57237 }
57238
57239 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) {
57240         LDKChannelTypeFeatures this_arg_conv;
57241         this_arg_conv.inner = untag_ptr(this_arg);
57242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57244         this_arg_conv.is_owned = false;
57245         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57246 }
57247
57248 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57249         LDKChannelTypeFeatures this_arg_conv;
57250         this_arg_conv.inner = untag_ptr(this_arg);
57251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57253         this_arg_conv.is_owned = false;
57254         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57255         return ret_conv;
57256 }
57257
57258 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57259         LDKInitFeatures this_arg_conv;
57260         this_arg_conv.inner = untag_ptr(this_arg);
57261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57263         this_arg_conv.is_owned = false;
57264         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57265         return ret_conv;
57266 }
57267
57268 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57269         LDKNodeFeatures this_arg_conv;
57270         this_arg_conv.inner = untag_ptr(this_arg);
57271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57273         this_arg_conv.is_owned = false;
57274         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57275         return ret_conv;
57276 }
57277
57278 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57279         LDKChannelTypeFeatures this_arg_conv;
57280         this_arg_conv.inner = untag_ptr(this_arg);
57281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57283         this_arg_conv.is_owned = false;
57284         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57285         return ret_conv;
57286 }
57287
57288 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) {
57289         LDKInitFeatures this_arg_conv;
57290         this_arg_conv.inner = untag_ptr(this_arg);
57291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57293         this_arg_conv.is_owned = false;
57294         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57295 }
57296
57297 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) {
57298         LDKInitFeatures this_arg_conv;
57299         this_arg_conv.inner = untag_ptr(this_arg);
57300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57302         this_arg_conv.is_owned = false;
57303         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57304 }
57305
57306 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57307         LDKInitFeatures this_arg_conv;
57308         this_arg_conv.inner = untag_ptr(this_arg);
57309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57311         this_arg_conv.is_owned = false;
57312         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57313         return ret_conv;
57314 }
57315
57316 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) {
57317         LDKNodeFeatures this_arg_conv;
57318         this_arg_conv.inner = untag_ptr(this_arg);
57319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57321         this_arg_conv.is_owned = false;
57322         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57323 }
57324
57325 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) {
57326         LDKNodeFeatures this_arg_conv;
57327         this_arg_conv.inner = untag_ptr(this_arg);
57328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57330         this_arg_conv.is_owned = false;
57331         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57332 }
57333
57334 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57335         LDKNodeFeatures this_arg_conv;
57336         this_arg_conv.inner = untag_ptr(this_arg);
57337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57339         this_arg_conv.is_owned = false;
57340         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57341         return ret_conv;
57342 }
57343
57344 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) {
57345         LDKChannelTypeFeatures this_arg_conv;
57346         this_arg_conv.inner = untag_ptr(this_arg);
57347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57349         this_arg_conv.is_owned = false;
57350         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57351 }
57352
57353 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) {
57354         LDKChannelTypeFeatures this_arg_conv;
57355         this_arg_conv.inner = untag_ptr(this_arg);
57356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57358         this_arg_conv.is_owned = false;
57359         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57360 }
57361
57362 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57363         LDKChannelTypeFeatures this_arg_conv;
57364         this_arg_conv.inner = untag_ptr(this_arg);
57365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57367         this_arg_conv.is_owned = false;
57368         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57369         return ret_conv;
57370 }
57371
57372 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57373         LDKInitFeatures this_arg_conv;
57374         this_arg_conv.inner = untag_ptr(this_arg);
57375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57377         this_arg_conv.is_owned = false;
57378         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57379         return ret_conv;
57380 }
57381
57382 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57383         LDKNodeFeatures this_arg_conv;
57384         this_arg_conv.inner = untag_ptr(this_arg);
57385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57387         this_arg_conv.is_owned = false;
57388         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57389         return ret_conv;
57390 }
57391
57392 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57393         LDKChannelTypeFeatures this_arg_conv;
57394         this_arg_conv.inner = untag_ptr(this_arg);
57395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57397         this_arg_conv.is_owned = false;
57398         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57399         return ret_conv;
57400 }
57401
57402 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_optional"))) TS_InitFeatures_set_route_blinding_optional(uint64_t this_arg) {
57403         LDKInitFeatures this_arg_conv;
57404         this_arg_conv.inner = untag_ptr(this_arg);
57405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57407         this_arg_conv.is_owned = false;
57408         InitFeatures_set_route_blinding_optional(&this_arg_conv);
57409 }
57410
57411 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_required"))) TS_InitFeatures_set_route_blinding_required(uint64_t this_arg) {
57412         LDKInitFeatures this_arg_conv;
57413         this_arg_conv.inner = untag_ptr(this_arg);
57414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57416         this_arg_conv.is_owned = false;
57417         InitFeatures_set_route_blinding_required(&this_arg_conv);
57418 }
57419
57420 jboolean  __attribute__((export_name("TS_InitFeatures_supports_route_blinding"))) TS_InitFeatures_supports_route_blinding(uint64_t this_arg) {
57421         LDKInitFeatures this_arg_conv;
57422         this_arg_conv.inner = untag_ptr(this_arg);
57423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57425         this_arg_conv.is_owned = false;
57426         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
57427         return ret_conv;
57428 }
57429
57430 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_optional"))) TS_NodeFeatures_set_route_blinding_optional(uint64_t this_arg) {
57431         LDKNodeFeatures this_arg_conv;
57432         this_arg_conv.inner = untag_ptr(this_arg);
57433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57435         this_arg_conv.is_owned = false;
57436         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
57437 }
57438
57439 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_required"))) TS_NodeFeatures_set_route_blinding_required(uint64_t this_arg) {
57440         LDKNodeFeatures this_arg_conv;
57441         this_arg_conv.inner = untag_ptr(this_arg);
57442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57444         this_arg_conv.is_owned = false;
57445         NodeFeatures_set_route_blinding_required(&this_arg_conv);
57446 }
57447
57448 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_route_blinding"))) TS_NodeFeatures_supports_route_blinding(uint64_t this_arg) {
57449         LDKNodeFeatures this_arg_conv;
57450         this_arg_conv.inner = untag_ptr(this_arg);
57451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57453         this_arg_conv.is_owned = false;
57454         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
57455         return ret_conv;
57456 }
57457
57458 jboolean  __attribute__((export_name("TS_InitFeatures_requires_route_blinding"))) TS_InitFeatures_requires_route_blinding(uint64_t this_arg) {
57459         LDKInitFeatures this_arg_conv;
57460         this_arg_conv.inner = untag_ptr(this_arg);
57461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57463         this_arg_conv.is_owned = false;
57464         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
57465         return ret_conv;
57466 }
57467
57468 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_route_blinding"))) TS_NodeFeatures_requires_route_blinding(uint64_t this_arg) {
57469         LDKNodeFeatures this_arg_conv;
57470         this_arg_conv.inner = untag_ptr(this_arg);
57471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57473         this_arg_conv.is_owned = false;
57474         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
57475         return ret_conv;
57476 }
57477
57478 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
57479         LDKInitFeatures this_arg_conv;
57480         this_arg_conv.inner = untag_ptr(this_arg);
57481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57483         this_arg_conv.is_owned = false;
57484         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57485 }
57486
57487 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
57488         LDKInitFeatures this_arg_conv;
57489         this_arg_conv.inner = untag_ptr(this_arg);
57490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57492         this_arg_conv.is_owned = false;
57493         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57494 }
57495
57496 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
57497         LDKInitFeatures this_arg_conv;
57498         this_arg_conv.inner = untag_ptr(this_arg);
57499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57501         this_arg_conv.is_owned = false;
57502         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57503         return ret_conv;
57504 }
57505
57506 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
57507         LDKNodeFeatures this_arg_conv;
57508         this_arg_conv.inner = untag_ptr(this_arg);
57509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57511         this_arg_conv.is_owned = false;
57512         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57513 }
57514
57515 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
57516         LDKNodeFeatures this_arg_conv;
57517         this_arg_conv.inner = untag_ptr(this_arg);
57518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57520         this_arg_conv.is_owned = false;
57521         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57522 }
57523
57524 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
57525         LDKNodeFeatures this_arg_conv;
57526         this_arg_conv.inner = untag_ptr(this_arg);
57527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57529         this_arg_conv.is_owned = false;
57530         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57531         return ret_conv;
57532 }
57533
57534 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
57535         LDKInitFeatures this_arg_conv;
57536         this_arg_conv.inner = untag_ptr(this_arg);
57537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57539         this_arg_conv.is_owned = false;
57540         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57541         return ret_conv;
57542 }
57543
57544 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
57545         LDKNodeFeatures this_arg_conv;
57546         this_arg_conv.inner = untag_ptr(this_arg);
57547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57549         this_arg_conv.is_owned = false;
57550         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57551         return ret_conv;
57552 }
57553
57554 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
57555         LDKInitFeatures this_arg_conv;
57556         this_arg_conv.inner = untag_ptr(this_arg);
57557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57559         this_arg_conv.is_owned = false;
57560         InitFeatures_set_taproot_optional(&this_arg_conv);
57561 }
57562
57563 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
57564         LDKInitFeatures this_arg_conv;
57565         this_arg_conv.inner = untag_ptr(this_arg);
57566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57568         this_arg_conv.is_owned = false;
57569         InitFeatures_set_taproot_required(&this_arg_conv);
57570 }
57571
57572 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
57573         LDKInitFeatures this_arg_conv;
57574         this_arg_conv.inner = untag_ptr(this_arg);
57575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57577         this_arg_conv.is_owned = false;
57578         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
57579         return ret_conv;
57580 }
57581
57582 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
57583         LDKNodeFeatures this_arg_conv;
57584         this_arg_conv.inner = untag_ptr(this_arg);
57585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57587         this_arg_conv.is_owned = false;
57588         NodeFeatures_set_taproot_optional(&this_arg_conv);
57589 }
57590
57591 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
57592         LDKNodeFeatures this_arg_conv;
57593         this_arg_conv.inner = untag_ptr(this_arg);
57594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57596         this_arg_conv.is_owned = false;
57597         NodeFeatures_set_taproot_required(&this_arg_conv);
57598 }
57599
57600 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
57601         LDKNodeFeatures this_arg_conv;
57602         this_arg_conv.inner = untag_ptr(this_arg);
57603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57605         this_arg_conv.is_owned = false;
57606         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
57607         return ret_conv;
57608 }
57609
57610 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
57611         LDKChannelTypeFeatures this_arg_conv;
57612         this_arg_conv.inner = untag_ptr(this_arg);
57613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57615         this_arg_conv.is_owned = false;
57616         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
57617 }
57618
57619 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
57620         LDKChannelTypeFeatures this_arg_conv;
57621         this_arg_conv.inner = untag_ptr(this_arg);
57622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57624         this_arg_conv.is_owned = false;
57625         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
57626 }
57627
57628 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
57629         LDKChannelTypeFeatures this_arg_conv;
57630         this_arg_conv.inner = untag_ptr(this_arg);
57631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57633         this_arg_conv.is_owned = false;
57634         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
57635         return ret_conv;
57636 }
57637
57638 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
57639         LDKInitFeatures this_arg_conv;
57640         this_arg_conv.inner = untag_ptr(this_arg);
57641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57643         this_arg_conv.is_owned = false;
57644         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
57645         return ret_conv;
57646 }
57647
57648 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
57649         LDKNodeFeatures this_arg_conv;
57650         this_arg_conv.inner = untag_ptr(this_arg);
57651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57653         this_arg_conv.is_owned = false;
57654         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
57655         return ret_conv;
57656 }
57657
57658 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
57659         LDKChannelTypeFeatures this_arg_conv;
57660         this_arg_conv.inner = untag_ptr(this_arg);
57661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57663         this_arg_conv.is_owned = false;
57664         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
57665         return ret_conv;
57666 }
57667
57668 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
57669         LDKInitFeatures this_arg_conv;
57670         this_arg_conv.inner = untag_ptr(this_arg);
57671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57673         this_arg_conv.is_owned = false;
57674         InitFeatures_set_onion_messages_optional(&this_arg_conv);
57675 }
57676
57677 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
57678         LDKInitFeatures this_arg_conv;
57679         this_arg_conv.inner = untag_ptr(this_arg);
57680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57682         this_arg_conv.is_owned = false;
57683         InitFeatures_set_onion_messages_required(&this_arg_conv);
57684 }
57685
57686 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
57687         LDKInitFeatures this_arg_conv;
57688         this_arg_conv.inner = untag_ptr(this_arg);
57689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57691         this_arg_conv.is_owned = false;
57692         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
57693         return ret_conv;
57694 }
57695
57696 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
57697         LDKNodeFeatures this_arg_conv;
57698         this_arg_conv.inner = untag_ptr(this_arg);
57699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57701         this_arg_conv.is_owned = false;
57702         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
57703 }
57704
57705 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
57706         LDKNodeFeatures this_arg_conv;
57707         this_arg_conv.inner = untag_ptr(this_arg);
57708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57710         this_arg_conv.is_owned = false;
57711         NodeFeatures_set_onion_messages_required(&this_arg_conv);
57712 }
57713
57714 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
57715         LDKNodeFeatures this_arg_conv;
57716         this_arg_conv.inner = untag_ptr(this_arg);
57717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57719         this_arg_conv.is_owned = false;
57720         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
57721         return ret_conv;
57722 }
57723
57724 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
57725         LDKInitFeatures this_arg_conv;
57726         this_arg_conv.inner = untag_ptr(this_arg);
57727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57729         this_arg_conv.is_owned = false;
57730         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
57731         return ret_conv;
57732 }
57733
57734 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
57735         LDKNodeFeatures this_arg_conv;
57736         this_arg_conv.inner = untag_ptr(this_arg);
57737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57739         this_arg_conv.is_owned = false;
57740         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
57741         return ret_conv;
57742 }
57743
57744 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
57745         LDKInitFeatures this_arg_conv;
57746         this_arg_conv.inner = untag_ptr(this_arg);
57747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57749         this_arg_conv.is_owned = false;
57750         InitFeatures_set_channel_type_optional(&this_arg_conv);
57751 }
57752
57753 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
57754         LDKInitFeatures this_arg_conv;
57755         this_arg_conv.inner = untag_ptr(this_arg);
57756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57758         this_arg_conv.is_owned = false;
57759         InitFeatures_set_channel_type_required(&this_arg_conv);
57760 }
57761
57762 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
57763         LDKInitFeatures this_arg_conv;
57764         this_arg_conv.inner = untag_ptr(this_arg);
57765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57767         this_arg_conv.is_owned = false;
57768         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
57769         return ret_conv;
57770 }
57771
57772 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
57773         LDKNodeFeatures this_arg_conv;
57774         this_arg_conv.inner = untag_ptr(this_arg);
57775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57777         this_arg_conv.is_owned = false;
57778         NodeFeatures_set_channel_type_optional(&this_arg_conv);
57779 }
57780
57781 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
57782         LDKNodeFeatures this_arg_conv;
57783         this_arg_conv.inner = untag_ptr(this_arg);
57784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57786         this_arg_conv.is_owned = false;
57787         NodeFeatures_set_channel_type_required(&this_arg_conv);
57788 }
57789
57790 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
57791         LDKNodeFeatures this_arg_conv;
57792         this_arg_conv.inner = untag_ptr(this_arg);
57793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57795         this_arg_conv.is_owned = false;
57796         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
57797         return ret_conv;
57798 }
57799
57800 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
57801         LDKInitFeatures this_arg_conv;
57802         this_arg_conv.inner = untag_ptr(this_arg);
57803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57805         this_arg_conv.is_owned = false;
57806         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
57807         return ret_conv;
57808 }
57809
57810 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
57811         LDKNodeFeatures this_arg_conv;
57812         this_arg_conv.inner = untag_ptr(this_arg);
57813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57815         this_arg_conv.is_owned = false;
57816         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
57817         return ret_conv;
57818 }
57819
57820 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
57821         LDKInitFeatures this_arg_conv;
57822         this_arg_conv.inner = untag_ptr(this_arg);
57823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57825         this_arg_conv.is_owned = false;
57826         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
57827 }
57828
57829 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
57830         LDKInitFeatures this_arg_conv;
57831         this_arg_conv.inner = untag_ptr(this_arg);
57832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57834         this_arg_conv.is_owned = false;
57835         InitFeatures_set_scid_privacy_required(&this_arg_conv);
57836 }
57837
57838 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
57839         LDKInitFeatures this_arg_conv;
57840         this_arg_conv.inner = untag_ptr(this_arg);
57841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57843         this_arg_conv.is_owned = false;
57844         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
57845         return ret_conv;
57846 }
57847
57848 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
57849         LDKNodeFeatures this_arg_conv;
57850         this_arg_conv.inner = untag_ptr(this_arg);
57851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57853         this_arg_conv.is_owned = false;
57854         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
57855 }
57856
57857 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
57858         LDKNodeFeatures this_arg_conv;
57859         this_arg_conv.inner = untag_ptr(this_arg);
57860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57862         this_arg_conv.is_owned = false;
57863         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
57864 }
57865
57866 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
57867         LDKNodeFeatures this_arg_conv;
57868         this_arg_conv.inner = untag_ptr(this_arg);
57869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57871         this_arg_conv.is_owned = false;
57872         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
57873         return ret_conv;
57874 }
57875
57876 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
57877         LDKChannelTypeFeatures this_arg_conv;
57878         this_arg_conv.inner = untag_ptr(this_arg);
57879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57881         this_arg_conv.is_owned = false;
57882         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
57883 }
57884
57885 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
57886         LDKChannelTypeFeatures this_arg_conv;
57887         this_arg_conv.inner = untag_ptr(this_arg);
57888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57890         this_arg_conv.is_owned = false;
57891         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
57892 }
57893
57894 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
57895         LDKChannelTypeFeatures this_arg_conv;
57896         this_arg_conv.inner = untag_ptr(this_arg);
57897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57899         this_arg_conv.is_owned = false;
57900         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
57901         return ret_conv;
57902 }
57903
57904 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
57905         LDKInitFeatures this_arg_conv;
57906         this_arg_conv.inner = untag_ptr(this_arg);
57907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57909         this_arg_conv.is_owned = false;
57910         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
57911         return ret_conv;
57912 }
57913
57914 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
57915         LDKNodeFeatures this_arg_conv;
57916         this_arg_conv.inner = untag_ptr(this_arg);
57917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57919         this_arg_conv.is_owned = false;
57920         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
57921         return ret_conv;
57922 }
57923
57924 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
57925         LDKChannelTypeFeatures this_arg_conv;
57926         this_arg_conv.inner = untag_ptr(this_arg);
57927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57929         this_arg_conv.is_owned = false;
57930         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
57931         return ret_conv;
57932 }
57933
57934 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
57935         LDKBolt11InvoiceFeatures this_arg_conv;
57936         this_arg_conv.inner = untag_ptr(this_arg);
57937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57939         this_arg_conv.is_owned = false;
57940         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
57941 }
57942
57943 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
57944         LDKBolt11InvoiceFeatures this_arg_conv;
57945         this_arg_conv.inner = untag_ptr(this_arg);
57946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57948         this_arg_conv.is_owned = false;
57949         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
57950 }
57951
57952 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
57953         LDKBolt11InvoiceFeatures this_arg_conv;
57954         this_arg_conv.inner = untag_ptr(this_arg);
57955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57957         this_arg_conv.is_owned = false;
57958         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
57959         return ret_conv;
57960 }
57961
57962 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
57963         LDKBolt11InvoiceFeatures this_arg_conv;
57964         this_arg_conv.inner = untag_ptr(this_arg);
57965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57967         this_arg_conv.is_owned = false;
57968         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
57969         return ret_conv;
57970 }
57971
57972 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
57973         LDKInitFeatures this_arg_conv;
57974         this_arg_conv.inner = untag_ptr(this_arg);
57975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57977         this_arg_conv.is_owned = false;
57978         InitFeatures_set_zero_conf_optional(&this_arg_conv);
57979 }
57980
57981 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
57982         LDKInitFeatures this_arg_conv;
57983         this_arg_conv.inner = untag_ptr(this_arg);
57984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57986         this_arg_conv.is_owned = false;
57987         InitFeatures_set_zero_conf_required(&this_arg_conv);
57988 }
57989
57990 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
57991         LDKInitFeatures this_arg_conv;
57992         this_arg_conv.inner = untag_ptr(this_arg);
57993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57995         this_arg_conv.is_owned = false;
57996         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
57997         return ret_conv;
57998 }
57999
58000 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
58001         LDKNodeFeatures this_arg_conv;
58002         this_arg_conv.inner = untag_ptr(this_arg);
58003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58005         this_arg_conv.is_owned = false;
58006         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
58007 }
58008
58009 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
58010         LDKNodeFeatures this_arg_conv;
58011         this_arg_conv.inner = untag_ptr(this_arg);
58012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58014         this_arg_conv.is_owned = false;
58015         NodeFeatures_set_zero_conf_required(&this_arg_conv);
58016 }
58017
58018 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
58019         LDKNodeFeatures this_arg_conv;
58020         this_arg_conv.inner = untag_ptr(this_arg);
58021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58023         this_arg_conv.is_owned = false;
58024         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
58025         return ret_conv;
58026 }
58027
58028 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
58029         LDKChannelTypeFeatures this_arg_conv;
58030         this_arg_conv.inner = untag_ptr(this_arg);
58031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58033         this_arg_conv.is_owned = false;
58034         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
58035 }
58036
58037 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
58038         LDKChannelTypeFeatures this_arg_conv;
58039         this_arg_conv.inner = untag_ptr(this_arg);
58040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58042         this_arg_conv.is_owned = false;
58043         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
58044 }
58045
58046 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
58047         LDKChannelTypeFeatures this_arg_conv;
58048         this_arg_conv.inner = untag_ptr(this_arg);
58049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58051         this_arg_conv.is_owned = false;
58052         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
58053         return ret_conv;
58054 }
58055
58056 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
58057         LDKInitFeatures this_arg_conv;
58058         this_arg_conv.inner = untag_ptr(this_arg);
58059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58061         this_arg_conv.is_owned = false;
58062         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
58063         return ret_conv;
58064 }
58065
58066 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
58067         LDKNodeFeatures this_arg_conv;
58068         this_arg_conv.inner = untag_ptr(this_arg);
58069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58071         this_arg_conv.is_owned = false;
58072         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
58073         return ret_conv;
58074 }
58075
58076 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
58077         LDKChannelTypeFeatures this_arg_conv;
58078         this_arg_conv.inner = untag_ptr(this_arg);
58079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58081         this_arg_conv.is_owned = false;
58082         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
58083         return ret_conv;
58084 }
58085
58086 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
58087         LDKNodeFeatures this_arg_conv;
58088         this_arg_conv.inner = untag_ptr(this_arg);
58089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58091         this_arg_conv.is_owned = false;
58092         NodeFeatures_set_keysend_optional(&this_arg_conv);
58093 }
58094
58095 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
58096         LDKNodeFeatures this_arg_conv;
58097         this_arg_conv.inner = untag_ptr(this_arg);
58098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58100         this_arg_conv.is_owned = false;
58101         NodeFeatures_set_keysend_required(&this_arg_conv);
58102 }
58103
58104 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
58105         LDKNodeFeatures this_arg_conv;
58106         this_arg_conv.inner = untag_ptr(this_arg);
58107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58109         this_arg_conv.is_owned = false;
58110         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
58111         return ret_conv;
58112 }
58113
58114 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
58115         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
58121         return ret_conv;
58122 }
58123
58124 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
58125         LDKShutdownScript this_obj_conv;
58126         this_obj_conv.inner = untag_ptr(this_obj);
58127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58129         ShutdownScript_free(this_obj_conv);
58130 }
58131
58132 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
58133         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
58134         uint64_t ret_ref = 0;
58135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58137         return ret_ref;
58138 }
58139 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
58140         LDKShutdownScript arg_conv;
58141         arg_conv.inner = untag_ptr(arg);
58142         arg_conv.is_owned = ptr_is_owned(arg);
58143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58144         arg_conv.is_owned = false;
58145         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
58146         return ret_conv;
58147 }
58148
58149 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
58150         LDKShutdownScript orig_conv;
58151         orig_conv.inner = untag_ptr(orig);
58152         orig_conv.is_owned = ptr_is_owned(orig);
58153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58154         orig_conv.is_owned = false;
58155         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
58156         uint64_t ret_ref = 0;
58157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58159         return ret_ref;
58160 }
58161
58162 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
58163         LDKShutdownScript a_conv;
58164         a_conv.inner = untag_ptr(a);
58165         a_conv.is_owned = ptr_is_owned(a);
58166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58167         a_conv.is_owned = false;
58168         LDKShutdownScript b_conv;
58169         b_conv.inner = untag_ptr(b);
58170         b_conv.is_owned = ptr_is_owned(b);
58171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58172         b_conv.is_owned = false;
58173         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
58174         return ret_conv;
58175 }
58176
58177 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
58178         LDKInvalidShutdownScript this_obj_conv;
58179         this_obj_conv.inner = untag_ptr(this_obj);
58180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58182         InvalidShutdownScript_free(this_obj_conv);
58183 }
58184
58185 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
58186         LDKInvalidShutdownScript this_ptr_conv;
58187         this_ptr_conv.inner = untag_ptr(this_ptr);
58188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58190         this_ptr_conv.is_owned = false;
58191         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
58192         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58193         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58194         CVec_u8Z_free(ret_var);
58195         return ret_arr;
58196 }
58197
58198 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
58199         LDKInvalidShutdownScript this_ptr_conv;
58200         this_ptr_conv.inner = untag_ptr(this_ptr);
58201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58203         this_ptr_conv.is_owned = false;
58204         LDKCVec_u8Z val_ref;
58205         val_ref.datalen = val->arr_len;
58206         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58207         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58208         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
58209 }
58210
58211 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
58212         LDKCVec_u8Z script_arg_ref;
58213         script_arg_ref.datalen = script_arg->arr_len;
58214         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58215         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
58216         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
58217         uint64_t ret_ref = 0;
58218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58220         return ret_ref;
58221 }
58222
58223 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
58224         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
58225         uint64_t ret_ref = 0;
58226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58228         return ret_ref;
58229 }
58230 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
58231         LDKInvalidShutdownScript arg_conv;
58232         arg_conv.inner = untag_ptr(arg);
58233         arg_conv.is_owned = ptr_is_owned(arg);
58234         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58235         arg_conv.is_owned = false;
58236         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
58237         return ret_conv;
58238 }
58239
58240 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
58241         LDKInvalidShutdownScript orig_conv;
58242         orig_conv.inner = untag_ptr(orig);
58243         orig_conv.is_owned = ptr_is_owned(orig);
58244         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58245         orig_conv.is_owned = false;
58246         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
58247         uint64_t ret_ref = 0;
58248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58250         return ret_ref;
58251 }
58252
58253 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
58254         LDKShutdownScript obj_conv;
58255         obj_conv.inner = untag_ptr(obj);
58256         obj_conv.is_owned = ptr_is_owned(obj);
58257         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58258         obj_conv.is_owned = false;
58259         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
58260         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58261         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58262         CVec_u8Z_free(ret_var);
58263         return ret_arr;
58264 }
58265
58266 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
58267         LDKu8slice ser_ref;
58268         ser_ref.datalen = ser->arr_len;
58269         ser_ref.data = ser->elems;
58270         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
58271         *ret_conv = ShutdownScript_read(ser_ref);
58272         FREE(ser);
58273         return tag_ptr(ret_conv, true);
58274 }
58275
58276 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
58277         uint8_t pubkey_hash_arr[20];
58278         CHECK(pubkey_hash->arr_len == 20);
58279         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
58280         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
58281         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
58282         uint64_t ret_ref = 0;
58283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58285         return ret_ref;
58286 }
58287
58288 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
58289         uint8_t script_hash_arr[32];
58290         CHECK(script_hash->arr_len == 32);
58291         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
58292         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
58293         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
58294         uint64_t ret_ref = 0;
58295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58297         return ret_ref;
58298 }
58299
58300 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(uint64_t witness_program) {
58301         void* witness_program_ptr = untag_ptr(witness_program);
58302         CHECK_ACCESS(witness_program_ptr);
58303         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
58304         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
58305         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
58306         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
58307         return tag_ptr(ret_conv, true);
58308 }
58309
58310 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
58311         LDKShutdownScript this_arg_conv;
58312         this_arg_conv.inner = untag_ptr(this_arg);
58313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58315         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
58316         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
58317         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58318         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58319         CVec_u8Z_free(ret_var);
58320         return ret_arr;
58321 }
58322
58323 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
58324         LDKShutdownScript this_arg_conv;
58325         this_arg_conv.inner = untag_ptr(this_arg);
58326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58328         this_arg_conv.is_owned = false;
58329         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58330         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
58331         return ret_arr;
58332 }
58333
58334 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
58335         LDKShutdownScript this_arg_conv;
58336         this_arg_conv.inner = untag_ptr(this_arg);
58337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58339         this_arg_conv.is_owned = false;
58340         LDKInitFeatures features_conv;
58341         features_conv.inner = untag_ptr(features);
58342         features_conv.is_owned = ptr_is_owned(features);
58343         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58344         features_conv.is_owned = false;
58345         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
58346         return ret_conv;
58347 }
58348
58349 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
58350         if (!ptr_is_owned(this_ptr)) return;
58351         void* this_ptr_ptr = untag_ptr(this_ptr);
58352         CHECK_ACCESS(this_ptr_ptr);
58353         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
58354         FREE(untag_ptr(this_ptr));
58355         Retry_free(this_ptr_conv);
58356 }
58357
58358 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
58359         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58360         *ret_copy = Retry_clone(arg);
58361         uint64_t ret_ref = tag_ptr(ret_copy, true);
58362         return ret_ref;
58363 }
58364 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
58365         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
58366         int64_t ret_conv = Retry_clone_ptr(arg_conv);
58367         return ret_conv;
58368 }
58369
58370 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
58371         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
58372         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58373         *ret_copy = Retry_clone(orig_conv);
58374         uint64_t ret_ref = tag_ptr(ret_copy, true);
58375         return ret_ref;
58376 }
58377
58378 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
58379         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58380         *ret_copy = Retry_attempts(a);
58381         uint64_t ret_ref = tag_ptr(ret_copy, true);
58382         return ret_ref;
58383 }
58384
58385 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
58386         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
58387         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
58388         jboolean ret_conv = Retry_eq(a_conv, b_conv);
58389         return ret_conv;
58390 }
58391
58392 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
58393         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
58394         int64_t ret_conv = Retry_hash(o_conv);
58395         return ret_conv;
58396 }
58397
58398 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
58399         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
58400         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
58401         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58402         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58403         CVec_u8Z_free(ret_var);
58404         return ret_arr;
58405 }
58406
58407 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
58408         LDKu8slice ser_ref;
58409         ser_ref.datalen = ser->arr_len;
58410         ser_ref.data = ser->elems;
58411         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
58412         *ret_conv = Retry_read(ser_ref);
58413         FREE(ser);
58414         return tag_ptr(ret_conv, true);
58415 }
58416
58417 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
58418         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
58419         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
58420         return ret_conv;
58421 }
58422
58423 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
58424         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
58425         return ret_conv;
58426 }
58427
58428 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
58429         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
58430         return ret_conv;
58431 }
58432
58433 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
58434         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
58435         return ret_conv;
58436 }
58437
58438 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
58439         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
58440         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
58441         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
58442         return ret_conv;
58443 }
58444
58445 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
58446         if (!ptr_is_owned(this_ptr)) return;
58447         void* this_ptr_ptr = untag_ptr(this_ptr);
58448         CHECK_ACCESS(this_ptr_ptr);
58449         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
58450         FREE(untag_ptr(this_ptr));
58451         PaymentSendFailure_free(this_ptr_conv);
58452 }
58453
58454 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
58455         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58456         *ret_copy = PaymentSendFailure_clone(arg);
58457         uint64_t ret_ref = tag_ptr(ret_copy, true);
58458         return ret_ref;
58459 }
58460 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
58461         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
58462         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
58463         return ret_conv;
58464 }
58465
58466 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
58467         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
58468         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58469         *ret_copy = PaymentSendFailure_clone(orig_conv);
58470         uint64_t ret_ref = tag_ptr(ret_copy, true);
58471         return ret_ref;
58472 }
58473
58474 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
58475         void* a_ptr = untag_ptr(a);
58476         CHECK_ACCESS(a_ptr);
58477         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
58478         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
58479         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58480         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
58481         uint64_t ret_ref = tag_ptr(ret_copy, true);
58482         return ret_ref;
58483 }
58484
58485 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
58486         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
58487         a_constr.datalen = a->arr_len;
58488         if (a_constr.datalen > 0)
58489                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58490         else
58491                 a_constr.data = NULL;
58492         uint64_t* a_vals = a->elems;
58493         for (size_t w = 0; w < a_constr.datalen; w++) {
58494                 uint64_t a_conv_22 = a_vals[w];
58495                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
58496                 CHECK_ACCESS(a_conv_22_ptr);
58497                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
58498                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
58499                 a_constr.data[w] = a_conv_22_conv;
58500         }
58501         FREE(a);
58502         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58503         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
58504         uint64_t ret_ref = tag_ptr(ret_copy, true);
58505         return ret_ref;
58506 }
58507
58508 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
58509         LDKCVec_APIErrorZ a_constr;
58510         a_constr.datalen = a->arr_len;
58511         if (a_constr.datalen > 0)
58512                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
58513         else
58514                 a_constr.data = NULL;
58515         uint64_t* a_vals = a->elems;
58516         for (size_t k = 0; k < a_constr.datalen; k++) {
58517                 uint64_t a_conv_10 = a_vals[k];
58518                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
58519                 CHECK_ACCESS(a_conv_10_ptr);
58520                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
58521                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
58522                 a_constr.data[k] = a_conv_10_conv;
58523         }
58524         FREE(a);
58525         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58526         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
58527         uint64_t ret_ref = tag_ptr(ret_copy, true);
58528         return ret_ref;
58529 }
58530
58531 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
58532         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58533         *ret_copy = PaymentSendFailure_duplicate_payment();
58534         uint64_t ret_ref = tag_ptr(ret_copy, true);
58535         return ret_ref;
58536 }
58537
58538 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) {
58539         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
58540         results_constr.datalen = results->arr_len;
58541         if (results_constr.datalen > 0)
58542                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58543         else
58544                 results_constr.data = NULL;
58545         uint64_t* results_vals = results->elems;
58546         for (size_t w = 0; w < results_constr.datalen; w++) {
58547                 uint64_t results_conv_22 = results_vals[w];
58548                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
58549                 CHECK_ACCESS(results_conv_22_ptr);
58550                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
58551                 results_constr.data[w] = results_conv_22_conv;
58552         }
58553         FREE(results);
58554         LDKRouteParameters failed_paths_retry_conv;
58555         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
58556         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
58557         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
58558         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
58559         LDKThirtyTwoBytes payment_id_ref;
58560         CHECK(payment_id->arr_len == 32);
58561         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
58562         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58563         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
58564         uint64_t ret_ref = tag_ptr(ret_copy, true);
58565         return ret_ref;
58566 }
58567
58568 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
58569         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
58570         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
58571         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
58572         return ret_conv;
58573 }
58574
58575 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
58576         if (!ptr_is_owned(this_ptr)) return;
58577         void* this_ptr_ptr = untag_ptr(this_ptr);
58578         CHECK_ACCESS(this_ptr_ptr);
58579         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
58580         FREE(untag_ptr(this_ptr));
58581         ProbeSendFailure_free(this_ptr_conv);
58582 }
58583
58584 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
58585         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58586         *ret_copy = ProbeSendFailure_clone(arg);
58587         uint64_t ret_ref = tag_ptr(ret_copy, true);
58588         return ret_ref;
58589 }
58590 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
58591         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
58592         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
58593         return ret_conv;
58594 }
58595
58596 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
58597         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
58598         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58599         *ret_copy = ProbeSendFailure_clone(orig_conv);
58600         uint64_t ret_ref = tag_ptr(ret_copy, true);
58601         return ret_ref;
58602 }
58603
58604 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
58605         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58606         *ret_copy = ProbeSendFailure_route_not_found();
58607         uint64_t ret_ref = tag_ptr(ret_copy, true);
58608         return ret_ref;
58609 }
58610
58611 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
58612         void* a_ptr = untag_ptr(a);
58613         CHECK_ACCESS(a_ptr);
58614         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
58615         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
58616         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58617         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
58618         uint64_t ret_ref = tag_ptr(ret_copy, true);
58619         return ret_ref;
58620 }
58621
58622 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
58623         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
58624         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
58625         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
58626         return ret_conv;
58627 }
58628
58629 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
58630         LDKRecipientOnionFields this_obj_conv;
58631         this_obj_conv.inner = untag_ptr(this_obj);
58632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58634         RecipientOnionFields_free(this_obj_conv);
58635 }
58636
58637 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
58638         LDKRecipientOnionFields this_ptr_conv;
58639         this_ptr_conv.inner = untag_ptr(this_ptr);
58640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58642         this_ptr_conv.is_owned = false;
58643         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58644         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
58645         uint64_t ret_ref = tag_ptr(ret_copy, true);
58646         return ret_ref;
58647 }
58648
58649 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
58650         LDKRecipientOnionFields this_ptr_conv;
58651         this_ptr_conv.inner = untag_ptr(this_ptr);
58652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58654         this_ptr_conv.is_owned = false;
58655         void* val_ptr = untag_ptr(val);
58656         CHECK_ACCESS(val_ptr);
58657         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58658         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58659         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
58660 }
58661
58662 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
58663         LDKRecipientOnionFields this_ptr_conv;
58664         this_ptr_conv.inner = untag_ptr(this_ptr);
58665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58667         this_ptr_conv.is_owned = false;
58668         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58669         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
58670         uint64_t ret_ref = tag_ptr(ret_copy, true);
58671         return ret_ref;
58672 }
58673
58674 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
58675         LDKRecipientOnionFields this_ptr_conv;
58676         this_ptr_conv.inner = untag_ptr(this_ptr);
58677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58679         this_ptr_conv.is_owned = false;
58680         void* val_ptr = untag_ptr(val);
58681         CHECK_ACCESS(val_ptr);
58682         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
58683         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
58684         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
58685 }
58686
58687 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
58688         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
58689         uint64_t ret_ref = 0;
58690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58692         return ret_ref;
58693 }
58694 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
58695         LDKRecipientOnionFields arg_conv;
58696         arg_conv.inner = untag_ptr(arg);
58697         arg_conv.is_owned = ptr_is_owned(arg);
58698         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58699         arg_conv.is_owned = false;
58700         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
58701         return ret_conv;
58702 }
58703
58704 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
58705         LDKRecipientOnionFields orig_conv;
58706         orig_conv.inner = untag_ptr(orig);
58707         orig_conv.is_owned = ptr_is_owned(orig);
58708         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58709         orig_conv.is_owned = false;
58710         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
58711         uint64_t ret_ref = 0;
58712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58714         return ret_ref;
58715 }
58716
58717 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
58718         LDKRecipientOnionFields a_conv;
58719         a_conv.inner = untag_ptr(a);
58720         a_conv.is_owned = ptr_is_owned(a);
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58722         a_conv.is_owned = false;
58723         LDKRecipientOnionFields b_conv;
58724         b_conv.inner = untag_ptr(b);
58725         b_conv.is_owned = ptr_is_owned(b);
58726         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58727         b_conv.is_owned = false;
58728         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
58729         return ret_conv;
58730 }
58731
58732 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
58733         LDKRecipientOnionFields obj_conv;
58734         obj_conv.inner = untag_ptr(obj);
58735         obj_conv.is_owned = ptr_is_owned(obj);
58736         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58737         obj_conv.is_owned = false;
58738         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
58739         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58740         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58741         CVec_u8Z_free(ret_var);
58742         return ret_arr;
58743 }
58744
58745 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
58746         LDKu8slice ser_ref;
58747         ser_ref.datalen = ser->arr_len;
58748         ser_ref.data = ser->elems;
58749         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
58750         *ret_conv = RecipientOnionFields_read(ser_ref);
58751         FREE(ser);
58752         return tag_ptr(ret_conv, true);
58753 }
58754
58755 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
58756         LDKThirtyTwoBytes payment_secret_ref;
58757         CHECK(payment_secret->arr_len == 32);
58758         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
58759         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
58760         uint64_t ret_ref = 0;
58761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58763         return ret_ref;
58764 }
58765
58766 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
58767         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
58768         uint64_t ret_ref = 0;
58769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58771         return ret_ref;
58772 }
58773
58774 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
58775         LDKRecipientOnionFields this_arg_conv;
58776         this_arg_conv.inner = untag_ptr(this_arg);
58777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58779         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
58780         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
58781         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
58782         if (custom_tlvs_constr.datalen > 0)
58783                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
58784         else
58785                 custom_tlvs_constr.data = NULL;
58786         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
58787         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
58788                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
58789                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
58790                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
58791                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
58792                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
58793                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
58794         }
58795         FREE(custom_tlvs);
58796         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
58797         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
58798         return tag_ptr(ret_conv, true);
58799 }
58800
58801 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
58802         LDKRecipientOnionFields this_arg_conv;
58803         this_arg_conv.inner = untag_ptr(this_arg);
58804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58806         this_arg_conv.is_owned = false;
58807         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
58808         uint64_tArray ret_arr = NULL;
58809         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58810         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58811         for (size_t x = 0; x < ret_var.datalen; x++) {
58812                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
58813                 *ret_conv_23_conv = ret_var.data[x];
58814                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
58815         }
58816         
58817         FREE(ret_var.data);
58818         return ret_arr;
58819 }
58820
58821 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
58822         if (!ptr_is_owned(this_ptr)) return;
58823         void* this_ptr_ptr = untag_ptr(this_ptr);
58824         CHECK_ACCESS(this_ptr_ptr);
58825         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
58826         FREE(untag_ptr(this_ptr));
58827         CustomMessageReader_free(this_ptr_conv);
58828 }
58829
58830 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
58831         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58832         *ret_ret = Type_clone(arg);
58833         return tag_ptr(ret_ret, true);
58834 }
58835 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
58836         void* arg_ptr = untag_ptr(arg);
58837         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58838         LDKType* arg_conv = (LDKType*)arg_ptr;
58839         int64_t ret_conv = Type_clone_ptr(arg_conv);
58840         return ret_conv;
58841 }
58842
58843 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
58844         void* orig_ptr = untag_ptr(orig);
58845         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58846         LDKType* orig_conv = (LDKType*)orig_ptr;
58847         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58848         *ret_ret = Type_clone(orig_conv);
58849         return tag_ptr(ret_ret, true);
58850 }
58851
58852 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
58853         if (!ptr_is_owned(this_ptr)) return;
58854         void* this_ptr_ptr = untag_ptr(this_ptr);
58855         CHECK_ACCESS(this_ptr_ptr);
58856         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
58857         FREE(untag_ptr(this_ptr));
58858         Type_free(this_ptr_conv);
58859 }
58860
58861 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
58862         LDKOffer this_obj_conv;
58863         this_obj_conv.inner = untag_ptr(this_obj);
58864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58866         Offer_free(this_obj_conv);
58867 }
58868
58869 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
58870         LDKOffer ret_var = Offer_clone(arg);
58871         uint64_t ret_ref = 0;
58872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58874         return ret_ref;
58875 }
58876 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
58877         LDKOffer arg_conv;
58878         arg_conv.inner = untag_ptr(arg);
58879         arg_conv.is_owned = ptr_is_owned(arg);
58880         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58881         arg_conv.is_owned = false;
58882         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
58883         return ret_conv;
58884 }
58885
58886 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
58887         LDKOffer orig_conv;
58888         orig_conv.inner = untag_ptr(orig);
58889         orig_conv.is_owned = ptr_is_owned(orig);
58890         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58891         orig_conv.is_owned = false;
58892         LDKOffer ret_var = Offer_clone(&orig_conv);
58893         uint64_t ret_ref = 0;
58894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58896         return ret_ref;
58897 }
58898
58899 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
58900         LDKOffer this_arg_conv;
58901         this_arg_conv.inner = untag_ptr(this_arg);
58902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58904         this_arg_conv.is_owned = false;
58905         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
58906         ptrArray ret_arr = NULL;
58907         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58908         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58909         for (size_t m = 0; m < ret_var.datalen; m++) {
58910                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
58911                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
58912                 ret_arr_ptr[m] = ret_conv_12_arr;
58913         }
58914         
58915         FREE(ret_var.data);
58916         return ret_arr;
58917 }
58918
58919 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
58920         LDKOffer this_arg_conv;
58921         this_arg_conv.inner = untag_ptr(this_arg);
58922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58924         this_arg_conv.is_owned = false;
58925         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58926         *ret_copy = Offer_metadata(&this_arg_conv);
58927         uint64_t ret_ref = tag_ptr(ret_copy, true);
58928         return ret_ref;
58929 }
58930
58931 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
58932         LDKOffer this_arg_conv;
58933         this_arg_conv.inner = untag_ptr(this_arg);
58934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58936         this_arg_conv.is_owned = false;
58937         LDKAmount ret_var = Offer_amount(&this_arg_conv);
58938         uint64_t ret_ref = 0;
58939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58941         return ret_ref;
58942 }
58943
58944 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
58945         LDKOffer this_arg_conv;
58946         this_arg_conv.inner = untag_ptr(this_arg);
58947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58949         this_arg_conv.is_owned = false;
58950         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
58951         uint64_t ret_ref = 0;
58952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58954         return ret_ref;
58955 }
58956
58957 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
58958         LDKOffer this_arg_conv;
58959         this_arg_conv.inner = untag_ptr(this_arg);
58960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58962         this_arg_conv.is_owned = false;
58963         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
58964         uint64_t ret_ref = 0;
58965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58967         return ret_ref;
58968 }
58969
58970 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
58971         LDKOffer this_arg_conv;
58972         this_arg_conv.inner = untag_ptr(this_arg);
58973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58975         this_arg_conv.is_owned = false;
58976         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58977         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
58978         uint64_t ret_ref = tag_ptr(ret_copy, true);
58979         return ret_ref;
58980 }
58981
58982 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
58983         LDKOffer this_arg_conv;
58984         this_arg_conv.inner = untag_ptr(this_arg);
58985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58987         this_arg_conv.is_owned = false;
58988         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
58989         uint64_t ret_ref = 0;
58990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58992         return ret_ref;
58993 }
58994
58995 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
58996         LDKOffer this_arg_conv;
58997         this_arg_conv.inner = untag_ptr(this_arg);
58998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59000         this_arg_conv.is_owned = false;
59001         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
59002         uint64_tArray ret_arr = NULL;
59003         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59004         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59005         for (size_t n = 0; n < ret_var.datalen; n++) {
59006                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59007                 uint64_t ret_conv_13_ref = 0;
59008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59009                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59010                 ret_arr_ptr[n] = ret_conv_13_ref;
59011         }
59012         
59013         FREE(ret_var.data);
59014         return ret_arr;
59015 }
59016
59017 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
59018         LDKOffer this_arg_conv;
59019         this_arg_conv.inner = untag_ptr(this_arg);
59020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59022         this_arg_conv.is_owned = false;
59023         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_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 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
59031         LDKOffer this_arg_conv;
59032         this_arg_conv.inner = untag_ptr(this_arg);
59033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59035         this_arg_conv.is_owned = false;
59036         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59037         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
59038         return ret_arr;
59039 }
59040
59041 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
59042         LDKOffer this_arg_conv;
59043         this_arg_conv.inner = untag_ptr(this_arg);
59044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59046         this_arg_conv.is_owned = false;
59047         LDKThirtyTwoBytes chain_ref;
59048         CHECK(chain->arr_len == 32);
59049         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
59050         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
59051         return ret_conv;
59052 }
59053
59054 jboolean  __attribute__((export_name("TS_Offer_is_expired_no_std"))) TS_Offer_is_expired_no_std(uint64_t this_arg, int64_t duration_since_epoch) {
59055         LDKOffer this_arg_conv;
59056         this_arg_conv.inner = untag_ptr(this_arg);
59057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59059         this_arg_conv.is_owned = false;
59060         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
59061         return ret_conv;
59062 }
59063
59064 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
59065         LDKOffer this_arg_conv;
59066         this_arg_conv.inner = untag_ptr(this_arg);
59067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59069         this_arg_conv.is_owned = false;
59070         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
59071         return ret_conv;
59072 }
59073
59074 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
59075         LDKOffer this_arg_conv;
59076         this_arg_conv.inner = untag_ptr(this_arg);
59077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59079         this_arg_conv.is_owned = false;
59080         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
59081         return ret_conv;
59082 }
59083
59084 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
59085         LDKOffer obj_conv;
59086         obj_conv.inner = untag_ptr(obj);
59087         obj_conv.is_owned = ptr_is_owned(obj);
59088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59089         obj_conv.is_owned = false;
59090         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
59091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59093         CVec_u8Z_free(ret_var);
59094         return ret_arr;
59095 }
59096
59097 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
59098         LDKAmount this_obj_conv;
59099         this_obj_conv.inner = untag_ptr(this_obj);
59100         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59102         Amount_free(this_obj_conv);
59103 }
59104
59105 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
59106         LDKAmount ret_var = Amount_clone(arg);
59107         uint64_t ret_ref = 0;
59108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59110         return ret_ref;
59111 }
59112 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
59113         LDKAmount arg_conv;
59114         arg_conv.inner = untag_ptr(arg);
59115         arg_conv.is_owned = ptr_is_owned(arg);
59116         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59117         arg_conv.is_owned = false;
59118         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
59119         return ret_conv;
59120 }
59121
59122 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
59123         LDKAmount orig_conv;
59124         orig_conv.inner = untag_ptr(orig);
59125         orig_conv.is_owned = ptr_is_owned(orig);
59126         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59127         orig_conv.is_owned = false;
59128         LDKAmount ret_var = Amount_clone(&orig_conv);
59129         uint64_t ret_ref = 0;
59130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59132         return ret_ref;
59133 }
59134
59135 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
59136         LDKQuantity this_obj_conv;
59137         this_obj_conv.inner = untag_ptr(this_obj);
59138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59140         Quantity_free(this_obj_conv);
59141 }
59142
59143 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
59144         LDKQuantity ret_var = Quantity_clone(arg);
59145         uint64_t ret_ref = 0;
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59148         return ret_ref;
59149 }
59150 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
59151         LDKQuantity arg_conv;
59152         arg_conv.inner = untag_ptr(arg);
59153         arg_conv.is_owned = ptr_is_owned(arg);
59154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59155         arg_conv.is_owned = false;
59156         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
59157         return ret_conv;
59158 }
59159
59160 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
59161         LDKQuantity orig_conv;
59162         orig_conv.inner = untag_ptr(orig);
59163         orig_conv.is_owned = ptr_is_owned(orig);
59164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59165         orig_conv.is_owned = false;
59166         LDKQuantity ret_var = Quantity_clone(&orig_conv);
59167         uint64_t ret_ref = 0;
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59170         return ret_ref;
59171 }
59172
59173 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
59174         LDKStr s_conv = str_ref_to_owned_c(s);
59175         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
59176         *ret_conv = Offer_from_str(s_conv);
59177         return tag_ptr(ret_conv, true);
59178 }
59179
59180 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
59181         LDKUnsignedBolt12Invoice this_obj_conv;
59182         this_obj_conv.inner = untag_ptr(this_obj);
59183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59185         UnsignedBolt12Invoice_free(this_obj_conv);
59186 }
59187
59188 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
59189         LDKUnsignedBolt12Invoice this_arg_conv;
59190         this_arg_conv.inner = untag_ptr(this_arg);
59191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59193         this_arg_conv.is_owned = false;
59194         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
59195         uint64_t ret_ref = 0;
59196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59198         return ret_ref;
59199 }
59200
59201 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
59202         LDKBolt12Invoice this_obj_conv;
59203         this_obj_conv.inner = untag_ptr(this_obj);
59204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59206         Bolt12Invoice_free(this_obj_conv);
59207 }
59208
59209 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
59210         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
59211         uint64_t ret_ref = 0;
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59214         return ret_ref;
59215 }
59216 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
59217         LDKBolt12Invoice arg_conv;
59218         arg_conv.inner = untag_ptr(arg);
59219         arg_conv.is_owned = ptr_is_owned(arg);
59220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59221         arg_conv.is_owned = false;
59222         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
59223         return ret_conv;
59224 }
59225
59226 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
59227         LDKBolt12Invoice orig_conv;
59228         orig_conv.inner = untag_ptr(orig);
59229         orig_conv.is_owned = ptr_is_owned(orig);
59230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59231         orig_conv.is_owned = false;
59232         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
59233         uint64_t ret_ref = 0;
59234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59236         return ret_ref;
59237 }
59238
59239 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
59240         LDKUnsignedBolt12Invoice this_arg_conv;
59241         this_arg_conv.inner = untag_ptr(this_arg);
59242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59244         this_arg_conv.is_owned = false;
59245         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59246         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
59247         uint64_t ret_ref = tag_ptr(ret_copy, true);
59248         return ret_ref;
59249 }
59250
59251 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
59252         LDKUnsignedBolt12Invoice this_arg_conv;
59253         this_arg_conv.inner = untag_ptr(this_arg);
59254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59256         this_arg_conv.is_owned = false;
59257         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59258         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
59259         return ret_arr;
59260 }
59261
59262 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
59263         LDKUnsignedBolt12Invoice this_arg_conv;
59264         this_arg_conv.inner = untag_ptr(this_arg);
59265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59267         this_arg_conv.is_owned = false;
59268         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59269         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
59270         uint64_t ret_ref = tag_ptr(ret_copy, true);
59271         return ret_ref;
59272 }
59273
59274 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
59275         LDKUnsignedBolt12Invoice this_arg_conv;
59276         this_arg_conv.inner = untag_ptr(this_arg);
59277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59279         this_arg_conv.is_owned = false;
59280         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
59281         uint64_t ret_ref = 0;
59282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59284         return ret_ref;
59285 }
59286
59287 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
59288         LDKUnsignedBolt12Invoice this_arg_conv;
59289         this_arg_conv.inner = untag_ptr(this_arg);
59290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59292         this_arg_conv.is_owned = false;
59293         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
59294         uint64_t ret_ref = 0;
59295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59297         return ret_ref;
59298 }
59299
59300 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
59301         LDKUnsignedBolt12Invoice this_arg_conv;
59302         this_arg_conv.inner = untag_ptr(this_arg);
59303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59305         this_arg_conv.is_owned = false;
59306         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
59307         uint64_t ret_ref = 0;
59308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59310         return ret_ref;
59311 }
59312
59313 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
59314         LDKUnsignedBolt12Invoice this_arg_conv;
59315         this_arg_conv.inner = untag_ptr(this_arg);
59316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59318         this_arg_conv.is_owned = false;
59319         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59320         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
59321         uint64_t ret_ref = tag_ptr(ret_copy, true);
59322         return ret_ref;
59323 }
59324
59325 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
59326         LDKUnsignedBolt12Invoice this_arg_conv;
59327         this_arg_conv.inner = untag_ptr(this_arg);
59328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59330         this_arg_conv.is_owned = false;
59331         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
59332         uint64_t ret_ref = 0;
59333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59335         return ret_ref;
59336 }
59337
59338 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
59339         LDKUnsignedBolt12Invoice this_arg_conv;
59340         this_arg_conv.inner = untag_ptr(this_arg);
59341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59343         this_arg_conv.is_owned = false;
59344         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
59345         uint64_tArray ret_arr = NULL;
59346         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59347         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59348         for (size_t n = 0; n < ret_var.datalen; n++) {
59349                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59350                 uint64_t ret_conv_13_ref = 0;
59351                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59352                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59353                 ret_arr_ptr[n] = ret_conv_13_ref;
59354         }
59355         
59356         FREE(ret_var.data);
59357         return ret_arr;
59358 }
59359
59360 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
59361         LDKUnsignedBolt12Invoice this_arg_conv;
59362         this_arg_conv.inner = untag_ptr(this_arg);
59363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59365         this_arg_conv.is_owned = false;
59366         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
59367         uint64_t ret_ref = 0;
59368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59370         return ret_ref;
59371 }
59372
59373 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
59374         LDKUnsignedBolt12Invoice this_arg_conv;
59375         this_arg_conv.inner = untag_ptr(this_arg);
59376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59378         this_arg_conv.is_owned = false;
59379         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
59380         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59381         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59382         return ret_arr;
59383 }
59384
59385 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
59386         LDKUnsignedBolt12Invoice this_arg_conv;
59387         this_arg_conv.inner = untag_ptr(this_arg);
59388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59390         this_arg_conv.is_owned = false;
59391         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
59392         uint64_t ret_ref = 0;
59393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59395         return ret_ref;
59396 }
59397
59398 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
59399         LDKUnsignedBolt12Invoice this_arg_conv;
59400         this_arg_conv.inner = untag_ptr(this_arg);
59401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59403         this_arg_conv.is_owned = false;
59404         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59405         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
59406         uint64_t ret_ref = tag_ptr(ret_copy, true);
59407         return ret_ref;
59408 }
59409
59410 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
59411         LDKUnsignedBolt12Invoice this_arg_conv;
59412         this_arg_conv.inner = untag_ptr(this_arg);
59413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59415         this_arg_conv.is_owned = false;
59416         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59417         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
59418         return ret_arr;
59419 }
59420
59421 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
59422         LDKUnsignedBolt12Invoice this_arg_conv;
59423         this_arg_conv.inner = untag_ptr(this_arg);
59424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59426         this_arg_conv.is_owned = false;
59427         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
59428         uint64_t ret_ref = 0;
59429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59431         return ret_ref;
59432 }
59433
59434 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
59435         LDKUnsignedBolt12Invoice this_arg_conv;
59436         this_arg_conv.inner = untag_ptr(this_arg);
59437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59439         this_arg_conv.is_owned = false;
59440         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
59441         return ret_conv;
59442 }
59443
59444 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
59445         LDKUnsignedBolt12Invoice this_arg_conv;
59446         this_arg_conv.inner = untag_ptr(this_arg);
59447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59449         this_arg_conv.is_owned = false;
59450         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
59451         return ret_conv;
59452 }
59453
59454 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
59455         LDKUnsignedBolt12Invoice this_arg_conv;
59456         this_arg_conv.inner = untag_ptr(this_arg);
59457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59459         this_arg_conv.is_owned = false;
59460         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59461         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
59462         return ret_arr;
59463 }
59464
59465 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
59466         LDKUnsignedBolt12Invoice this_arg_conv;
59467         this_arg_conv.inner = untag_ptr(this_arg);
59468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59470         this_arg_conv.is_owned = false;
59471         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
59472         return ret_conv;
59473 }
59474
59475 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
59476         LDKUnsignedBolt12Invoice this_arg_conv;
59477         this_arg_conv.inner = untag_ptr(this_arg);
59478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59480         this_arg_conv.is_owned = false;
59481         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
59482         uint64_t ret_ref = 0;
59483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59485         return ret_ref;
59486 }
59487
59488 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
59489         LDKUnsignedBolt12Invoice this_arg_conv;
59490         this_arg_conv.inner = untag_ptr(this_arg);
59491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59493         this_arg_conv.is_owned = false;
59494         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59495         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
59496         return ret_arr;
59497 }
59498
59499 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
59500         LDKBolt12Invoice this_arg_conv;
59501         this_arg_conv.inner = untag_ptr(this_arg);
59502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59504         this_arg_conv.is_owned = false;
59505         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59506         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
59507         uint64_t ret_ref = tag_ptr(ret_copy, true);
59508         return ret_ref;
59509 }
59510
59511 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
59512         LDKBolt12Invoice this_arg_conv;
59513         this_arg_conv.inner = untag_ptr(this_arg);
59514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59516         this_arg_conv.is_owned = false;
59517         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59518         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
59519         return ret_arr;
59520 }
59521
59522 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
59523         LDKBolt12Invoice this_arg_conv;
59524         this_arg_conv.inner = untag_ptr(this_arg);
59525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59527         this_arg_conv.is_owned = false;
59528         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59529         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
59530         uint64_t ret_ref = tag_ptr(ret_copy, true);
59531         return ret_ref;
59532 }
59533
59534 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
59535         LDKBolt12Invoice this_arg_conv;
59536         this_arg_conv.inner = untag_ptr(this_arg);
59537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59539         this_arg_conv.is_owned = false;
59540         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
59541         uint64_t ret_ref = 0;
59542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59544         return ret_ref;
59545 }
59546
59547 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
59548         LDKBolt12Invoice this_arg_conv;
59549         this_arg_conv.inner = untag_ptr(this_arg);
59550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59552         this_arg_conv.is_owned = false;
59553         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
59554         uint64_t ret_ref = 0;
59555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59557         return ret_ref;
59558 }
59559
59560 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
59561         LDKBolt12Invoice this_arg_conv;
59562         this_arg_conv.inner = untag_ptr(this_arg);
59563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59565         this_arg_conv.is_owned = false;
59566         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
59567         uint64_t ret_ref = 0;
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59570         return ret_ref;
59571 }
59572
59573 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
59574         LDKBolt12Invoice this_arg_conv;
59575         this_arg_conv.inner = untag_ptr(this_arg);
59576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59578         this_arg_conv.is_owned = false;
59579         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59580         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
59581         uint64_t ret_ref = tag_ptr(ret_copy, true);
59582         return ret_ref;
59583 }
59584
59585 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
59586         LDKBolt12Invoice this_arg_conv;
59587         this_arg_conv.inner = untag_ptr(this_arg);
59588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59590         this_arg_conv.is_owned = false;
59591         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
59592         uint64_t ret_ref = 0;
59593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59595         return ret_ref;
59596 }
59597
59598 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
59599         LDKBolt12Invoice this_arg_conv;
59600         this_arg_conv.inner = untag_ptr(this_arg);
59601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59603         this_arg_conv.is_owned = false;
59604         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
59605         uint64_tArray ret_arr = NULL;
59606         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59607         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59608         for (size_t n = 0; n < ret_var.datalen; n++) {
59609                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59610                 uint64_t ret_conv_13_ref = 0;
59611                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59612                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59613                 ret_arr_ptr[n] = ret_conv_13_ref;
59614         }
59615         
59616         FREE(ret_var.data);
59617         return ret_arr;
59618 }
59619
59620 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
59621         LDKBolt12Invoice this_arg_conv;
59622         this_arg_conv.inner = untag_ptr(this_arg);
59623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59625         this_arg_conv.is_owned = false;
59626         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
59627         uint64_t ret_ref = 0;
59628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59630         return ret_ref;
59631 }
59632
59633 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
59634         LDKBolt12Invoice this_arg_conv;
59635         this_arg_conv.inner = untag_ptr(this_arg);
59636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59638         this_arg_conv.is_owned = false;
59639         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
59640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59642         return ret_arr;
59643 }
59644
59645 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
59646         LDKBolt12Invoice this_arg_conv;
59647         this_arg_conv.inner = untag_ptr(this_arg);
59648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59650         this_arg_conv.is_owned = false;
59651         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
59652         uint64_t ret_ref = 0;
59653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59655         return ret_ref;
59656 }
59657
59658 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
59659         LDKBolt12Invoice this_arg_conv;
59660         this_arg_conv.inner = untag_ptr(this_arg);
59661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59663         this_arg_conv.is_owned = false;
59664         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59665         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
59666         uint64_t ret_ref = tag_ptr(ret_copy, true);
59667         return ret_ref;
59668 }
59669
59670 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
59671         LDKBolt12Invoice this_arg_conv;
59672         this_arg_conv.inner = untag_ptr(this_arg);
59673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59675         this_arg_conv.is_owned = false;
59676         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59677         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
59678         return ret_arr;
59679 }
59680
59681 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
59682         LDKBolt12Invoice this_arg_conv;
59683         this_arg_conv.inner = untag_ptr(this_arg);
59684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59686         this_arg_conv.is_owned = false;
59687         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
59688         uint64_t ret_ref = 0;
59689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59691         return ret_ref;
59692 }
59693
59694 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
59695         LDKBolt12Invoice this_arg_conv;
59696         this_arg_conv.inner = untag_ptr(this_arg);
59697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59699         this_arg_conv.is_owned = false;
59700         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
59701         return ret_conv;
59702 }
59703
59704 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
59705         LDKBolt12Invoice this_arg_conv;
59706         this_arg_conv.inner = untag_ptr(this_arg);
59707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59709         this_arg_conv.is_owned = false;
59710         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
59711         return ret_conv;
59712 }
59713
59714 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
59715         LDKBolt12Invoice this_arg_conv;
59716         this_arg_conv.inner = untag_ptr(this_arg);
59717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59719         this_arg_conv.is_owned = false;
59720         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59721         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
59722         return ret_arr;
59723 }
59724
59725 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
59726         LDKBolt12Invoice this_arg_conv;
59727         this_arg_conv.inner = untag_ptr(this_arg);
59728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59730         this_arg_conv.is_owned = false;
59731         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
59732         return ret_conv;
59733 }
59734
59735 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
59736         LDKBolt12Invoice this_arg_conv;
59737         this_arg_conv.inner = untag_ptr(this_arg);
59738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59740         this_arg_conv.is_owned = false;
59741         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
59742         uint64_t ret_ref = 0;
59743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59745         return ret_ref;
59746 }
59747
59748 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
59749         LDKBolt12Invoice this_arg_conv;
59750         this_arg_conv.inner = untag_ptr(this_arg);
59751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59753         this_arg_conv.is_owned = false;
59754         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59755         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
59756         return ret_arr;
59757 }
59758
59759 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
59760         LDKBolt12Invoice this_arg_conv;
59761         this_arg_conv.inner = untag_ptr(this_arg);
59762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59764         this_arg_conv.is_owned = false;
59765         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59766         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
59767         return ret_arr;
59768 }
59769
59770 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
59771         LDKBolt12Invoice this_arg_conv;
59772         this_arg_conv.inner = untag_ptr(this_arg);
59773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59775         this_arg_conv.is_owned = false;
59776         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59777         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
59778         return ret_arr;
59779 }
59780
59781 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
59782         LDKBolt12Invoice this_arg_conv;
59783         this_arg_conv.inner = untag_ptr(this_arg);
59784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59786         this_arg_conv.is_owned = false;
59787         LDKExpandedKey key_conv;
59788         key_conv.inner = untag_ptr(key);
59789         key_conv.is_owned = ptr_is_owned(key);
59790         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
59791         key_conv.is_owned = false;
59792         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
59793         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
59794         return tag_ptr(ret_conv, true);
59795 }
59796
59797 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
59798         LDKUnsignedBolt12Invoice 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 = UnsignedBolt12Invoice_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 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
59811         LDKBolt12Invoice obj_conv;
59812         obj_conv.inner = untag_ptr(obj);
59813         obj_conv.is_owned = ptr_is_owned(obj);
59814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59815         obj_conv.is_owned = false;
59816         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
59817         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59818         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59819         CVec_u8Z_free(ret_var);
59820         return ret_arr;
59821 }
59822
59823 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
59824         LDKBlindedPayInfo this_obj_conv;
59825         this_obj_conv.inner = untag_ptr(this_obj);
59826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59828         BlindedPayInfo_free(this_obj_conv);
59829 }
59830
59831 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
59832         LDKBlindedPayInfo this_ptr_conv;
59833         this_ptr_conv.inner = untag_ptr(this_ptr);
59834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59836         this_ptr_conv.is_owned = false;
59837         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
59838         return ret_conv;
59839 }
59840
59841 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
59842         LDKBlindedPayInfo this_ptr_conv;
59843         this_ptr_conv.inner = untag_ptr(this_ptr);
59844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59846         this_ptr_conv.is_owned = false;
59847         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
59848 }
59849
59850 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
59851         LDKBlindedPayInfo this_ptr_conv;
59852         this_ptr_conv.inner = untag_ptr(this_ptr);
59853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59855         this_ptr_conv.is_owned = false;
59856         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
59857         return ret_conv;
59858 }
59859
59860 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
59861         LDKBlindedPayInfo this_ptr_conv;
59862         this_ptr_conv.inner = untag_ptr(this_ptr);
59863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59865         this_ptr_conv.is_owned = false;
59866         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
59867 }
59868
59869 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
59870         LDKBlindedPayInfo this_ptr_conv;
59871         this_ptr_conv.inner = untag_ptr(this_ptr);
59872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59874         this_ptr_conv.is_owned = false;
59875         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
59876         return ret_conv;
59877 }
59878
59879 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
59880         LDKBlindedPayInfo this_ptr_conv;
59881         this_ptr_conv.inner = untag_ptr(this_ptr);
59882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59884         this_ptr_conv.is_owned = false;
59885         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
59886 }
59887
59888 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
59889         LDKBlindedPayInfo this_ptr_conv;
59890         this_ptr_conv.inner = untag_ptr(this_ptr);
59891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59893         this_ptr_conv.is_owned = false;
59894         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
59895         return ret_conv;
59896 }
59897
59898 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
59899         LDKBlindedPayInfo this_ptr_conv;
59900         this_ptr_conv.inner = untag_ptr(this_ptr);
59901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59903         this_ptr_conv.is_owned = false;
59904         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
59905 }
59906
59907 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
59908         LDKBlindedPayInfo this_ptr_conv;
59909         this_ptr_conv.inner = untag_ptr(this_ptr);
59910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59912         this_ptr_conv.is_owned = false;
59913         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
59914         return ret_conv;
59915 }
59916
59917 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
59918         LDKBlindedPayInfo this_ptr_conv;
59919         this_ptr_conv.inner = untag_ptr(this_ptr);
59920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59922         this_ptr_conv.is_owned = false;
59923         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
59924 }
59925
59926 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
59927         LDKBlindedPayInfo this_ptr_conv;
59928         this_ptr_conv.inner = untag_ptr(this_ptr);
59929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59931         this_ptr_conv.is_owned = false;
59932         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
59933         uint64_t ret_ref = 0;
59934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59936         return ret_ref;
59937 }
59938
59939 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
59940         LDKBlindedPayInfo this_ptr_conv;
59941         this_ptr_conv.inner = untag_ptr(this_ptr);
59942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59944         this_ptr_conv.is_owned = false;
59945         LDKBlindedHopFeatures val_conv;
59946         val_conv.inner = untag_ptr(val);
59947         val_conv.is_owned = ptr_is_owned(val);
59948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59949         val_conv = BlindedHopFeatures_clone(&val_conv);
59950         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
59951 }
59952
59953 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) {
59954         LDKBlindedHopFeatures features_arg_conv;
59955         features_arg_conv.inner = untag_ptr(features_arg);
59956         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59957         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59958         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
59959         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);
59960         uint64_t ret_ref = 0;
59961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59963         return ret_ref;
59964 }
59965
59966 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
59967         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
59968         uint64_t ret_ref = 0;
59969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59971         return ret_ref;
59972 }
59973 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
59974         LDKBlindedPayInfo arg_conv;
59975         arg_conv.inner = untag_ptr(arg);
59976         arg_conv.is_owned = ptr_is_owned(arg);
59977         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59978         arg_conv.is_owned = false;
59979         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
59980         return ret_conv;
59981 }
59982
59983 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
59984         LDKBlindedPayInfo orig_conv;
59985         orig_conv.inner = untag_ptr(orig);
59986         orig_conv.is_owned = ptr_is_owned(orig);
59987         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59988         orig_conv.is_owned = false;
59989         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
59990         uint64_t ret_ref = 0;
59991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59993         return ret_ref;
59994 }
59995
59996 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
59997         LDKBlindedPayInfo o_conv;
59998         o_conv.inner = untag_ptr(o);
59999         o_conv.is_owned = ptr_is_owned(o);
60000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60001         o_conv.is_owned = false;
60002         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
60003         return ret_conv;
60004 }
60005
60006 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
60007         LDKBlindedPayInfo a_conv;
60008         a_conv.inner = untag_ptr(a);
60009         a_conv.is_owned = ptr_is_owned(a);
60010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60011         a_conv.is_owned = false;
60012         LDKBlindedPayInfo b_conv;
60013         b_conv.inner = untag_ptr(b);
60014         b_conv.is_owned = ptr_is_owned(b);
60015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60016         b_conv.is_owned = false;
60017         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
60018         return ret_conv;
60019 }
60020
60021 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
60022         LDKBlindedPayInfo obj_conv;
60023         obj_conv.inner = untag_ptr(obj);
60024         obj_conv.is_owned = ptr_is_owned(obj);
60025         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60026         obj_conv.is_owned = false;
60027         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
60028         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60029         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60030         CVec_u8Z_free(ret_var);
60031         return ret_arr;
60032 }
60033
60034 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
60035         LDKu8slice ser_ref;
60036         ser_ref.datalen = ser->arr_len;
60037         ser_ref.data = ser->elems;
60038         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
60039         *ret_conv = BlindedPayInfo_read(ser_ref);
60040         FREE(ser);
60041         return tag_ptr(ret_conv, true);
60042 }
60043
60044 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
60045         LDKInvoiceError this_obj_conv;
60046         this_obj_conv.inner = untag_ptr(this_obj);
60047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60049         InvoiceError_free(this_obj_conv);
60050 }
60051
60052 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
60053         LDKInvoiceError this_ptr_conv;
60054         this_ptr_conv.inner = untag_ptr(this_ptr);
60055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60057         this_ptr_conv.is_owned = false;
60058         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
60059         uint64_t ret_ref = 0;
60060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60062         return ret_ref;
60063 }
60064
60065 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
60066         LDKInvoiceError this_ptr_conv;
60067         this_ptr_conv.inner = untag_ptr(this_ptr);
60068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60070         this_ptr_conv.is_owned = false;
60071         LDKErroneousField val_conv;
60072         val_conv.inner = untag_ptr(val);
60073         val_conv.is_owned = ptr_is_owned(val);
60074         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60075         val_conv = ErroneousField_clone(&val_conv);
60076         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
60077 }
60078
60079 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
60080         LDKInvoiceError this_ptr_conv;
60081         this_ptr_conv.inner = untag_ptr(this_ptr);
60082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60084         this_ptr_conv.is_owned = false;
60085         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_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 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
60093         LDKInvoiceError this_ptr_conv;
60094         this_ptr_conv.inner = untag_ptr(this_ptr);
60095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60097         this_ptr_conv.is_owned = false;
60098         LDKUntrustedString val_conv;
60099         val_conv.inner = untag_ptr(val);
60100         val_conv.is_owned = ptr_is_owned(val);
60101         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60102         val_conv = UntrustedString_clone(&val_conv);
60103         InvoiceError_set_message(&this_ptr_conv, val_conv);
60104 }
60105
60106 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
60107         LDKErroneousField erroneous_field_arg_conv;
60108         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
60109         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
60110         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
60111         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
60112         LDKUntrustedString message_arg_conv;
60113         message_arg_conv.inner = untag_ptr(message_arg);
60114         message_arg_conv.is_owned = ptr_is_owned(message_arg);
60115         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
60116         message_arg_conv = UntrustedString_clone(&message_arg_conv);
60117         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
60118         uint64_t ret_ref = 0;
60119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60121         return ret_ref;
60122 }
60123
60124 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
60125         LDKInvoiceError ret_var = InvoiceError_clone(arg);
60126         uint64_t ret_ref = 0;
60127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60129         return ret_ref;
60130 }
60131 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
60132         LDKInvoiceError arg_conv;
60133         arg_conv.inner = untag_ptr(arg);
60134         arg_conv.is_owned = ptr_is_owned(arg);
60135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60136         arg_conv.is_owned = false;
60137         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
60138         return ret_conv;
60139 }
60140
60141 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
60142         LDKInvoiceError orig_conv;
60143         orig_conv.inner = untag_ptr(orig);
60144         orig_conv.is_owned = ptr_is_owned(orig);
60145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60146         orig_conv.is_owned = false;
60147         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
60148         uint64_t ret_ref = 0;
60149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60151         return ret_ref;
60152 }
60153
60154 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
60155         LDKErroneousField this_obj_conv;
60156         this_obj_conv.inner = untag_ptr(this_obj);
60157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60159         ErroneousField_free(this_obj_conv);
60160 }
60161
60162 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
60163         LDKErroneousField this_ptr_conv;
60164         this_ptr_conv.inner = untag_ptr(this_ptr);
60165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60167         this_ptr_conv.is_owned = false;
60168         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
60169         return ret_conv;
60170 }
60171
60172 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
60173         LDKErroneousField this_ptr_conv;
60174         this_ptr_conv.inner = untag_ptr(this_ptr);
60175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60177         this_ptr_conv.is_owned = false;
60178         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
60179 }
60180
60181 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
60182         LDKErroneousField 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60188         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
60189         uint64_t ret_ref = tag_ptr(ret_copy, true);
60190         return ret_ref;
60191 }
60192
60193 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
60194         LDKErroneousField this_ptr_conv;
60195         this_ptr_conv.inner = untag_ptr(this_ptr);
60196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60198         this_ptr_conv.is_owned = false;
60199         void* val_ptr = untag_ptr(val);
60200         CHECK_ACCESS(val_ptr);
60201         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
60202         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
60203         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
60204 }
60205
60206 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
60207         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
60208         CHECK_ACCESS(suggested_value_arg_ptr);
60209         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
60210         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
60211         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
60212         uint64_t ret_ref = 0;
60213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60215         return ret_ref;
60216 }
60217
60218 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
60219         LDKErroneousField ret_var = ErroneousField_clone(arg);
60220         uint64_t ret_ref = 0;
60221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60223         return ret_ref;
60224 }
60225 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
60226         LDKErroneousField arg_conv;
60227         arg_conv.inner = untag_ptr(arg);
60228         arg_conv.is_owned = ptr_is_owned(arg);
60229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60230         arg_conv.is_owned = false;
60231         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
60232         return ret_conv;
60233 }
60234
60235 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
60236         LDKErroneousField orig_conv;
60237         orig_conv.inner = untag_ptr(orig);
60238         orig_conv.is_owned = ptr_is_owned(orig);
60239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60240         orig_conv.is_owned = false;
60241         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
60242         uint64_t ret_ref = 0;
60243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60245         return ret_ref;
60246 }
60247
60248 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
60249         LDKStr s_conv = str_ref_to_owned_c(s);
60250         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
60251         uint64_t ret_ref = 0;
60252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60254         return ret_ref;
60255 }
60256
60257 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
60258         LDKInvoiceError obj_conv;
60259         obj_conv.inner = untag_ptr(obj);
60260         obj_conv.is_owned = ptr_is_owned(obj);
60261         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60262         obj_conv.is_owned = false;
60263         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
60264         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60265         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60266         CVec_u8Z_free(ret_var);
60267         return ret_arr;
60268 }
60269
60270 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
60271         LDKu8slice ser_ref;
60272         ser_ref.datalen = ser->arr_len;
60273         ser_ref.data = ser->elems;
60274         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
60275         *ret_conv = InvoiceError_read(ser_ref);
60276         FREE(ser);
60277         return tag_ptr(ret_conv, true);
60278 }
60279
60280 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
60281         LDKUnsignedInvoiceRequest this_obj_conv;
60282         this_obj_conv.inner = untag_ptr(this_obj);
60283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60285         UnsignedInvoiceRequest_free(this_obj_conv);
60286 }
60287
60288 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
60289         LDKUnsignedInvoiceRequest this_arg_conv;
60290         this_arg_conv.inner = untag_ptr(this_arg);
60291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60293         this_arg_conv.is_owned = false;
60294         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
60295         uint64_t ret_ref = 0;
60296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60298         return ret_ref;
60299 }
60300
60301 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
60302         LDKInvoiceRequest this_obj_conv;
60303         this_obj_conv.inner = untag_ptr(this_obj);
60304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60306         InvoiceRequest_free(this_obj_conv);
60307 }
60308
60309 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
60310         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
60311         uint64_t ret_ref = 0;
60312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60314         return ret_ref;
60315 }
60316 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
60317         LDKInvoiceRequest arg_conv;
60318         arg_conv.inner = untag_ptr(arg);
60319         arg_conv.is_owned = ptr_is_owned(arg);
60320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60321         arg_conv.is_owned = false;
60322         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
60323         return ret_conv;
60324 }
60325
60326 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
60327         LDKInvoiceRequest orig_conv;
60328         orig_conv.inner = untag_ptr(orig);
60329         orig_conv.is_owned = ptr_is_owned(orig);
60330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60331         orig_conv.is_owned = false;
60332         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
60333         uint64_t ret_ref = 0;
60334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60336         return ret_ref;
60337 }
60338
60339 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
60340         LDKVerifiedInvoiceRequest this_obj_conv;
60341         this_obj_conv.inner = untag_ptr(this_obj);
60342         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60344         VerifiedInvoiceRequest_free(this_obj_conv);
60345 }
60346
60347 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
60348         LDKVerifiedInvoiceRequest this_ptr_conv;
60349         this_ptr_conv.inner = untag_ptr(this_ptr);
60350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60352         this_ptr_conv.is_owned = false;
60353         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
60354         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
60355         uint64_t ret_ref = tag_ptr(ret_copy, true);
60356         return ret_ref;
60357 }
60358
60359 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
60360         LDKVerifiedInvoiceRequest this_ptr_conv;
60361         this_ptr_conv.inner = untag_ptr(this_ptr);
60362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60364         this_ptr_conv.is_owned = false;
60365         void* val_ptr = untag_ptr(val);
60366         CHECK_ACCESS(val_ptr);
60367         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
60368         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
60369         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
60370 }
60371
60372 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
60373         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
60374         uint64_t ret_ref = 0;
60375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60377         return ret_ref;
60378 }
60379 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
60380         LDKVerifiedInvoiceRequest arg_conv;
60381         arg_conv.inner = untag_ptr(arg);
60382         arg_conv.is_owned = ptr_is_owned(arg);
60383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60384         arg_conv.is_owned = false;
60385         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
60386         return ret_conv;
60387 }
60388
60389 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
60390         LDKVerifiedInvoiceRequest orig_conv;
60391         orig_conv.inner = untag_ptr(orig);
60392         orig_conv.is_owned = ptr_is_owned(orig);
60393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60394         orig_conv.is_owned = false;
60395         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
60396         uint64_t ret_ref = 0;
60397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60399         return ret_ref;
60400 }
60401
60402 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
60403         LDKUnsignedInvoiceRequest this_arg_conv;
60404         this_arg_conv.inner = untag_ptr(this_arg);
60405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60407         this_arg_conv.is_owned = false;
60408         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
60409         ptrArray ret_arr = NULL;
60410         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60411         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60412         for (size_t m = 0; m < ret_var.datalen; m++) {
60413                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
60414                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
60415                 ret_arr_ptr[m] = ret_conv_12_arr;
60416         }
60417         
60418         FREE(ret_var.data);
60419         return ret_arr;
60420 }
60421
60422 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
60423         LDKUnsignedInvoiceRequest this_arg_conv;
60424         this_arg_conv.inner = untag_ptr(this_arg);
60425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60427         this_arg_conv.is_owned = false;
60428         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60429         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
60430         uint64_t ret_ref = tag_ptr(ret_copy, true);
60431         return ret_ref;
60432 }
60433
60434 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
60435         LDKUnsignedInvoiceRequest this_arg_conv;
60436         this_arg_conv.inner = untag_ptr(this_arg);
60437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60439         this_arg_conv.is_owned = false;
60440         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
60441         uint64_t ret_ref = 0;
60442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60444         return ret_ref;
60445 }
60446
60447 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
60448         LDKUnsignedInvoiceRequest this_arg_conv;
60449         this_arg_conv.inner = untag_ptr(this_arg);
60450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60452         this_arg_conv.is_owned = false;
60453         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
60454         uint64_t ret_ref = 0;
60455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60457         return ret_ref;
60458 }
60459
60460 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
60461         LDKUnsignedInvoiceRequest this_arg_conv;
60462         this_arg_conv.inner = untag_ptr(this_arg);
60463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60465         this_arg_conv.is_owned = false;
60466         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
60467         uint64_t ret_ref = 0;
60468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60470         return ret_ref;
60471 }
60472
60473 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
60474         LDKUnsignedInvoiceRequest this_arg_conv;
60475         this_arg_conv.inner = untag_ptr(this_arg);
60476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60478         this_arg_conv.is_owned = false;
60479         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60480         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
60481         uint64_t ret_ref = tag_ptr(ret_copy, true);
60482         return ret_ref;
60483 }
60484
60485 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
60486         LDKUnsignedInvoiceRequest this_arg_conv;
60487         this_arg_conv.inner = untag_ptr(this_arg);
60488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60490         this_arg_conv.is_owned = false;
60491         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
60492         uint64_t ret_ref = 0;
60493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60495         return ret_ref;
60496 }
60497
60498 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
60499         LDKUnsignedInvoiceRequest this_arg_conv;
60500         this_arg_conv.inner = untag_ptr(this_arg);
60501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60503         this_arg_conv.is_owned = false;
60504         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
60505         uint64_tArray ret_arr = NULL;
60506         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60507         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60508         for (size_t n = 0; n < ret_var.datalen; n++) {
60509                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60510                 uint64_t ret_conv_13_ref = 0;
60511                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60512                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60513                 ret_arr_ptr[n] = ret_conv_13_ref;
60514         }
60515         
60516         FREE(ret_var.data);
60517         return ret_arr;
60518 }
60519
60520 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
60521         LDKUnsignedInvoiceRequest this_arg_conv;
60522         this_arg_conv.inner = untag_ptr(this_arg);
60523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60525         this_arg_conv.is_owned = false;
60526         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
60527         uint64_t ret_ref = 0;
60528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60530         return ret_ref;
60531 }
60532
60533 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
60534         LDKUnsignedInvoiceRequest this_arg_conv;
60535         this_arg_conv.inner = untag_ptr(this_arg);
60536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60538         this_arg_conv.is_owned = false;
60539         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60540         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
60541         return ret_arr;
60542 }
60543
60544 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
60545         LDKUnsignedInvoiceRequest this_arg_conv;
60546         this_arg_conv.inner = untag_ptr(this_arg);
60547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60549         this_arg_conv.is_owned = false;
60550         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
60551         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60552         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60553         return ret_arr;
60554 }
60555
60556 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
60557         LDKUnsignedInvoiceRequest this_arg_conv;
60558         this_arg_conv.inner = untag_ptr(this_arg);
60559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60561         this_arg_conv.is_owned = false;
60562         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60563         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
60564         return ret_arr;
60565 }
60566
60567 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
60568         LDKUnsignedInvoiceRequest this_arg_conv;
60569         this_arg_conv.inner = untag_ptr(this_arg);
60570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60572         this_arg_conv.is_owned = false;
60573         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60574         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
60575         uint64_t ret_ref = tag_ptr(ret_copy, true);
60576         return ret_ref;
60577 }
60578
60579 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
60580         LDKUnsignedInvoiceRequest this_arg_conv;
60581         this_arg_conv.inner = untag_ptr(this_arg);
60582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60584         this_arg_conv.is_owned = false;
60585         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
60586         uint64_t ret_ref = 0;
60587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60589         return ret_ref;
60590 }
60591
60592 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
60593         LDKUnsignedInvoiceRequest this_arg_conv;
60594         this_arg_conv.inner = untag_ptr(this_arg);
60595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60597         this_arg_conv.is_owned = false;
60598         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60599         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
60600         uint64_t ret_ref = tag_ptr(ret_copy, true);
60601         return ret_ref;
60602 }
60603
60604 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
60605         LDKUnsignedInvoiceRequest this_arg_conv;
60606         this_arg_conv.inner = untag_ptr(this_arg);
60607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60609         this_arg_conv.is_owned = false;
60610         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60611         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
60612         return ret_arr;
60613 }
60614
60615 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
60616         LDKUnsignedInvoiceRequest this_arg_conv;
60617         this_arg_conv.inner = untag_ptr(this_arg);
60618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60620         this_arg_conv.is_owned = false;
60621         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
60622         uint64_t ret_ref = 0;
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60625         return ret_ref;
60626 }
60627
60628 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
60629         LDKInvoiceRequest this_arg_conv;
60630         this_arg_conv.inner = untag_ptr(this_arg);
60631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60633         this_arg_conv.is_owned = false;
60634         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
60635         ptrArray ret_arr = NULL;
60636         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60637         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60638         for (size_t m = 0; m < ret_var.datalen; m++) {
60639                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
60640                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
60641                 ret_arr_ptr[m] = ret_conv_12_arr;
60642         }
60643         
60644         FREE(ret_var.data);
60645         return ret_arr;
60646 }
60647
60648 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
60649         LDKInvoiceRequest this_arg_conv;
60650         this_arg_conv.inner = untag_ptr(this_arg);
60651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60653         this_arg_conv.is_owned = false;
60654         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60655         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
60656         uint64_t ret_ref = tag_ptr(ret_copy, true);
60657         return ret_ref;
60658 }
60659
60660 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
60661         LDKInvoiceRequest this_arg_conv;
60662         this_arg_conv.inner = untag_ptr(this_arg);
60663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60665         this_arg_conv.is_owned = false;
60666         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
60667         uint64_t ret_ref = 0;
60668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60670         return ret_ref;
60671 }
60672
60673 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
60674         LDKInvoiceRequest this_arg_conv;
60675         this_arg_conv.inner = untag_ptr(this_arg);
60676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60678         this_arg_conv.is_owned = false;
60679         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
60680         uint64_t ret_ref = 0;
60681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60683         return ret_ref;
60684 }
60685
60686 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
60687         LDKInvoiceRequest this_arg_conv;
60688         this_arg_conv.inner = untag_ptr(this_arg);
60689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60691         this_arg_conv.is_owned = false;
60692         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
60693         uint64_t ret_ref = 0;
60694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60696         return ret_ref;
60697 }
60698
60699 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
60700         LDKInvoiceRequest this_arg_conv;
60701         this_arg_conv.inner = untag_ptr(this_arg);
60702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60704         this_arg_conv.is_owned = false;
60705         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60706         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
60707         uint64_t ret_ref = tag_ptr(ret_copy, true);
60708         return ret_ref;
60709 }
60710
60711 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
60712         LDKInvoiceRequest this_arg_conv;
60713         this_arg_conv.inner = untag_ptr(this_arg);
60714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60716         this_arg_conv.is_owned = false;
60717         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
60718         uint64_t ret_ref = 0;
60719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60721         return ret_ref;
60722 }
60723
60724 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
60725         LDKInvoiceRequest this_arg_conv;
60726         this_arg_conv.inner = untag_ptr(this_arg);
60727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60729         this_arg_conv.is_owned = false;
60730         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
60731         uint64_tArray ret_arr = NULL;
60732         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60733         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60734         for (size_t n = 0; n < ret_var.datalen; n++) {
60735                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60736                 uint64_t ret_conv_13_ref = 0;
60737                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60738                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60739                 ret_arr_ptr[n] = ret_conv_13_ref;
60740         }
60741         
60742         FREE(ret_var.data);
60743         return ret_arr;
60744 }
60745
60746 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
60747         LDKInvoiceRequest this_arg_conv;
60748         this_arg_conv.inner = untag_ptr(this_arg);
60749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60751         this_arg_conv.is_owned = false;
60752         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
60753         uint64_t ret_ref = 0;
60754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60756         return ret_ref;
60757 }
60758
60759 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
60760         LDKInvoiceRequest this_arg_conv;
60761         this_arg_conv.inner = untag_ptr(this_arg);
60762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60764         this_arg_conv.is_owned = false;
60765         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60766         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
60767         return ret_arr;
60768 }
60769
60770 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
60771         LDKInvoiceRequest this_arg_conv;
60772         this_arg_conv.inner = untag_ptr(this_arg);
60773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60775         this_arg_conv.is_owned = false;
60776         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
60777         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60778         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60779         return ret_arr;
60780 }
60781
60782 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
60783         LDKInvoiceRequest this_arg_conv;
60784         this_arg_conv.inner = untag_ptr(this_arg);
60785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60787         this_arg_conv.is_owned = false;
60788         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60789         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
60790         return ret_arr;
60791 }
60792
60793 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
60794         LDKInvoiceRequest this_arg_conv;
60795         this_arg_conv.inner = untag_ptr(this_arg);
60796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60798         this_arg_conv.is_owned = false;
60799         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60800         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
60801         uint64_t ret_ref = tag_ptr(ret_copy, true);
60802         return ret_ref;
60803 }
60804
60805 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
60806         LDKInvoiceRequest this_arg_conv;
60807         this_arg_conv.inner = untag_ptr(this_arg);
60808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60810         this_arg_conv.is_owned = false;
60811         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
60812         uint64_t ret_ref = 0;
60813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60815         return ret_ref;
60816 }
60817
60818 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
60819         LDKInvoiceRequest this_arg_conv;
60820         this_arg_conv.inner = untag_ptr(this_arg);
60821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60823         this_arg_conv.is_owned = false;
60824         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60825         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
60826         uint64_t ret_ref = tag_ptr(ret_copy, true);
60827         return ret_ref;
60828 }
60829
60830 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
60831         LDKInvoiceRequest this_arg_conv;
60832         this_arg_conv.inner = untag_ptr(this_arg);
60833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60835         this_arg_conv.is_owned = false;
60836         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60837         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
60838         return ret_arr;
60839 }
60840
60841 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
60842         LDKInvoiceRequest this_arg_conv;
60843         this_arg_conv.inner = untag_ptr(this_arg);
60844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60846         this_arg_conv.is_owned = false;
60847         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
60848         uint64_t ret_ref = 0;
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60851         return ret_ref;
60852 }
60853
60854 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
60855         LDKInvoiceRequest this_arg_conv;
60856         this_arg_conv.inner = untag_ptr(this_arg);
60857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60859         this_arg_conv.is_owned = false;
60860         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60861         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
60862         return ret_arr;
60863 }
60864
60865 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
60866         LDKInvoiceRequest this_arg_conv;
60867         this_arg_conv.inner = untag_ptr(this_arg);
60868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60870         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
60871         LDKExpandedKey key_conv;
60872         key_conv.inner = untag_ptr(key);
60873         key_conv.is_owned = ptr_is_owned(key);
60874         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60875         key_conv.is_owned = false;
60876         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
60877         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
60878         return tag_ptr(ret_conv, true);
60879 }
60880
60881 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
60882         LDKVerifiedInvoiceRequest this_arg_conv;
60883         this_arg_conv.inner = untag_ptr(this_arg);
60884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60886         this_arg_conv.is_owned = false;
60887         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
60888         ptrArray ret_arr = NULL;
60889         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60890         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60891         for (size_t m = 0; m < ret_var.datalen; m++) {
60892                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
60893                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
60894                 ret_arr_ptr[m] = ret_conv_12_arr;
60895         }
60896         
60897         FREE(ret_var.data);
60898         return ret_arr;
60899 }
60900
60901 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
60902         LDKVerifiedInvoiceRequest this_arg_conv;
60903         this_arg_conv.inner = untag_ptr(this_arg);
60904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60906         this_arg_conv.is_owned = false;
60907         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60908         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
60909         uint64_t ret_ref = tag_ptr(ret_copy, true);
60910         return ret_ref;
60911 }
60912
60913 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
60914         LDKVerifiedInvoiceRequest this_arg_conv;
60915         this_arg_conv.inner = untag_ptr(this_arg);
60916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60918         this_arg_conv.is_owned = false;
60919         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
60920         uint64_t ret_ref = 0;
60921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60923         return ret_ref;
60924 }
60925
60926 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
60927         LDKVerifiedInvoiceRequest this_arg_conv;
60928         this_arg_conv.inner = untag_ptr(this_arg);
60929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60931         this_arg_conv.is_owned = false;
60932         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
60933         uint64_t ret_ref = 0;
60934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60936         return ret_ref;
60937 }
60938
60939 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
60940         LDKVerifiedInvoiceRequest this_arg_conv;
60941         this_arg_conv.inner = untag_ptr(this_arg);
60942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60944         this_arg_conv.is_owned = false;
60945         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
60946         uint64_t ret_ref = 0;
60947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60949         return ret_ref;
60950 }
60951
60952 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
60953         LDKVerifiedInvoiceRequest this_arg_conv;
60954         this_arg_conv.inner = untag_ptr(this_arg);
60955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60957         this_arg_conv.is_owned = false;
60958         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60959         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
60960         uint64_t ret_ref = tag_ptr(ret_copy, true);
60961         return ret_ref;
60962 }
60963
60964 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
60965         LDKVerifiedInvoiceRequest this_arg_conv;
60966         this_arg_conv.inner = untag_ptr(this_arg);
60967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60969         this_arg_conv.is_owned = false;
60970         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
60971         uint64_t ret_ref = 0;
60972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60974         return ret_ref;
60975 }
60976
60977 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
60978         LDKVerifiedInvoiceRequest this_arg_conv;
60979         this_arg_conv.inner = untag_ptr(this_arg);
60980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60982         this_arg_conv.is_owned = false;
60983         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
60984         uint64_tArray ret_arr = NULL;
60985         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60986         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60987         for (size_t n = 0; n < ret_var.datalen; n++) {
60988                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60989                 uint64_t ret_conv_13_ref = 0;
60990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60991                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60992                 ret_arr_ptr[n] = ret_conv_13_ref;
60993         }
60994         
60995         FREE(ret_var.data);
60996         return ret_arr;
60997 }
60998
60999 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
61000         LDKVerifiedInvoiceRequest this_arg_conv;
61001         this_arg_conv.inner = untag_ptr(this_arg);
61002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61004         this_arg_conv.is_owned = false;
61005         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
61006         uint64_t ret_ref = 0;
61007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61009         return ret_ref;
61010 }
61011
61012 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
61013         LDKVerifiedInvoiceRequest this_arg_conv;
61014         this_arg_conv.inner = untag_ptr(this_arg);
61015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61017         this_arg_conv.is_owned = false;
61018         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61019         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
61020         return ret_arr;
61021 }
61022
61023 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
61024         LDKVerifiedInvoiceRequest this_arg_conv;
61025         this_arg_conv.inner = untag_ptr(this_arg);
61026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61028         this_arg_conv.is_owned = false;
61029         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
61030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61032         return ret_arr;
61033 }
61034
61035 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
61036         LDKVerifiedInvoiceRequest this_arg_conv;
61037         this_arg_conv.inner = untag_ptr(this_arg);
61038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61040         this_arg_conv.is_owned = false;
61041         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61042         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
61043         return ret_arr;
61044 }
61045
61046 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
61047         LDKVerifiedInvoiceRequest this_arg_conv;
61048         this_arg_conv.inner = untag_ptr(this_arg);
61049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61051         this_arg_conv.is_owned = false;
61052         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61053         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
61054         uint64_t ret_ref = tag_ptr(ret_copy, true);
61055         return ret_ref;
61056 }
61057
61058 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
61059         LDKVerifiedInvoiceRequest this_arg_conv;
61060         this_arg_conv.inner = untag_ptr(this_arg);
61061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61063         this_arg_conv.is_owned = false;
61064         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
61065         uint64_t ret_ref = 0;
61066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61068         return ret_ref;
61069 }
61070
61071 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
61072         LDKVerifiedInvoiceRequest this_arg_conv;
61073         this_arg_conv.inner = untag_ptr(this_arg);
61074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61076         this_arg_conv.is_owned = false;
61077         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61078         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
61079         uint64_t ret_ref = tag_ptr(ret_copy, true);
61080         return ret_ref;
61081 }
61082
61083 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
61084         LDKVerifiedInvoiceRequest this_arg_conv;
61085         this_arg_conv.inner = untag_ptr(this_arg);
61086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61088         this_arg_conv.is_owned = false;
61089         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61090         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61091         return ret_arr;
61092 }
61093
61094 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
61095         LDKVerifiedInvoiceRequest this_arg_conv;
61096         this_arg_conv.inner = untag_ptr(this_arg);
61097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61099         this_arg_conv.is_owned = false;
61100         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
61101         uint64_t ret_ref = 0;
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61104         return ret_ref;
61105 }
61106
61107 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
61108         LDKUnsignedInvoiceRequest obj_conv;
61109         obj_conv.inner = untag_ptr(obj);
61110         obj_conv.is_owned = ptr_is_owned(obj);
61111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61112         obj_conv.is_owned = false;
61113         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
61114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61116         CVec_u8Z_free(ret_var);
61117         return ret_arr;
61118 }
61119
61120 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
61121         LDKInvoiceRequest obj_conv;
61122         obj_conv.inner = untag_ptr(obj);
61123         obj_conv.is_owned = ptr_is_owned(obj);
61124         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61125         obj_conv.is_owned = false;
61126         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
61127         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61128         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61129         CVec_u8Z_free(ret_var);
61130         return ret_arr;
61131 }
61132
61133 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
61134         LDKTaggedHash this_obj_conv;
61135         this_obj_conv.inner = untag_ptr(this_obj);
61136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61138         TaggedHash_free(this_obj_conv);
61139 }
61140
61141 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
61142         LDKTaggedHash ret_var = TaggedHash_clone(arg);
61143         uint64_t ret_ref = 0;
61144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61146         return ret_ref;
61147 }
61148 int64_t  __attribute__((export_name("TS_TaggedHash_clone_ptr"))) TS_TaggedHash_clone_ptr(uint64_t arg) {
61149         LDKTaggedHash arg_conv;
61150         arg_conv.inner = untag_ptr(arg);
61151         arg_conv.is_owned = ptr_is_owned(arg);
61152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61153         arg_conv.is_owned = false;
61154         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
61155         return ret_conv;
61156 }
61157
61158 uint64_t  __attribute__((export_name("TS_TaggedHash_clone"))) TS_TaggedHash_clone(uint64_t orig) {
61159         LDKTaggedHash orig_conv;
61160         orig_conv.inner = untag_ptr(orig);
61161         orig_conv.is_owned = ptr_is_owned(orig);
61162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61163         orig_conv.is_owned = false;
61164         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
61165         uint64_t ret_ref = 0;
61166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61168         return ret_ref;
61169 }
61170
61171 int8_tArray  __attribute__((export_name("TS_TaggedHash_as_digest"))) TS_TaggedHash_as_digest(uint64_t this_arg) {
61172         LDKTaggedHash this_arg_conv;
61173         this_arg_conv.inner = untag_ptr(this_arg);
61174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61176         this_arg_conv.is_owned = false;
61177         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61178         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
61179         return ret_arr;
61180 }
61181
61182 jstring  __attribute__((export_name("TS_TaggedHash_tag"))) TS_TaggedHash_tag(uint64_t this_arg) {
61183         LDKTaggedHash this_arg_conv;
61184         this_arg_conv.inner = untag_ptr(this_arg);
61185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61187         this_arg_conv.is_owned = false;
61188         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
61189         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
61190         Str_free(ret_str);
61191         return ret_conv;
61192 }
61193
61194 int8_tArray  __attribute__((export_name("TS_TaggedHash_merkle_root"))) TS_TaggedHash_merkle_root(uint64_t this_arg) {
61195         LDKTaggedHash this_arg_conv;
61196         this_arg_conv.inner = untag_ptr(this_arg);
61197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61199         this_arg_conv.is_owned = false;
61200         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61201         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
61202         return ret_arr;
61203 }
61204
61205 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
61206         LDKBolt12ParseError this_obj_conv;
61207         this_obj_conv.inner = untag_ptr(this_obj);
61208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61210         Bolt12ParseError_free(this_obj_conv);
61211 }
61212
61213 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
61214         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(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 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
61221         LDKBolt12ParseError arg_conv;
61222         arg_conv.inner = untag_ptr(arg);
61223         arg_conv.is_owned = ptr_is_owned(arg);
61224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61225         arg_conv.is_owned = false;
61226         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
61227         return ret_conv;
61228 }
61229
61230 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
61231         LDKBolt12ParseError orig_conv;
61232         orig_conv.inner = untag_ptr(orig);
61233         orig_conv.is_owned = ptr_is_owned(orig);
61234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61235         orig_conv.is_owned = false;
61236         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
61237         uint64_t ret_ref = 0;
61238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61240         return ret_ref;
61241 }
61242
61243 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
61244         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
61245         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
61246         return ret_conv;
61247 }
61248
61249 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
61250         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
61251         return ret_conv;
61252 }
61253
61254 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
61255         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
61256         return ret_conv;
61257 }
61258
61259 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
61260         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
61261         return ret_conv;
61262 }
61263
61264 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
61265         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
61266         return ret_conv;
61267 }
61268
61269 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
61270         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
61271         return ret_conv;
61272 }
61273
61274 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
61275         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
61276         return ret_conv;
61277 }
61278
61279 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
61280         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
61281         return ret_conv;
61282 }
61283
61284 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
61285         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
61286         return ret_conv;
61287 }
61288
61289 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
61290         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
61291         return ret_conv;
61292 }
61293
61294 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
61295         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
61296         return ret_conv;
61297 }
61298
61299 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
61300         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
61301         return ret_conv;
61302 }
61303
61304 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
61305         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
61306         return ret_conv;
61307 }
61308
61309 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
61310         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
61311         return ret_conv;
61312 }
61313
61314 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
61315         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
61316         return ret_conv;
61317 }
61318
61319 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
61320         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
61321         return ret_conv;
61322 }
61323
61324 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
61325         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
61326         return ret_conv;
61327 }
61328
61329 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
61330         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
61331         return ret_conv;
61332 }
61333
61334 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
61335         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
61336         return ret_conv;
61337 }
61338
61339 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
61340         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
61341         return ret_conv;
61342 }
61343
61344 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
61345         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
61346         return ret_conv;
61347 }
61348
61349 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
61350         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
61351         return ret_conv;
61352 }
61353
61354 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
61355         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
61356         return ret_conv;
61357 }
61358
61359 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
61360         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
61361         return ret_conv;
61362 }
61363
61364 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
61365         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
61366         return ret_conv;
61367 }
61368
61369 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
61370         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
61371         return ret_conv;
61372 }
61373
61374 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
61375         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
61376         return ret_conv;
61377 }
61378
61379 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
61380         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
61381         return ret_conv;
61382 }
61383
61384 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
61385         LDKRefund this_obj_conv;
61386         this_obj_conv.inner = untag_ptr(this_obj);
61387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61389         Refund_free(this_obj_conv);
61390 }
61391
61392 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
61393         LDKRefund ret_var = Refund_clone(arg);
61394         uint64_t ret_ref = 0;
61395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61397         return ret_ref;
61398 }
61399 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
61400         LDKRefund arg_conv;
61401         arg_conv.inner = untag_ptr(arg);
61402         arg_conv.is_owned = ptr_is_owned(arg);
61403         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61404         arg_conv.is_owned = false;
61405         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
61406         return ret_conv;
61407 }
61408
61409 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
61410         LDKRefund orig_conv;
61411         orig_conv.inner = untag_ptr(orig);
61412         orig_conv.is_owned = ptr_is_owned(orig);
61413         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61414         orig_conv.is_owned = false;
61415         LDKRefund ret_var = Refund_clone(&orig_conv);
61416         uint64_t ret_ref = 0;
61417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61419         return ret_ref;
61420 }
61421
61422 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
61423         LDKRefund this_arg_conv;
61424         this_arg_conv.inner = untag_ptr(this_arg);
61425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61427         this_arg_conv.is_owned = false;
61428         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
61429         uint64_t ret_ref = 0;
61430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61432         return ret_ref;
61433 }
61434
61435 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
61436         LDKRefund this_arg_conv;
61437         this_arg_conv.inner = untag_ptr(this_arg);
61438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61440         this_arg_conv.is_owned = false;
61441         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61442         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
61443         uint64_t ret_ref = tag_ptr(ret_copy, true);
61444         return ret_ref;
61445 }
61446
61447 jboolean  __attribute__((export_name("TS_Refund_is_expired_no_std"))) TS_Refund_is_expired_no_std(uint64_t this_arg, int64_t duration_since_epoch) {
61448         LDKRefund this_arg_conv;
61449         this_arg_conv.inner = untag_ptr(this_arg);
61450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61452         this_arg_conv.is_owned = false;
61453         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
61454         return ret_conv;
61455 }
61456
61457 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
61458         LDKRefund this_arg_conv;
61459         this_arg_conv.inner = untag_ptr(this_arg);
61460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61462         this_arg_conv.is_owned = false;
61463         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
61464         uint64_t ret_ref = 0;
61465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61467         return ret_ref;
61468 }
61469
61470 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
61471         LDKRefund this_arg_conv;
61472         this_arg_conv.inner = untag_ptr(this_arg);
61473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61475         this_arg_conv.is_owned = false;
61476         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
61477         uint64_tArray ret_arr = NULL;
61478         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
61479         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
61480         for (size_t n = 0; n < ret_var.datalen; n++) {
61481                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61482                 uint64_t ret_conv_13_ref = 0;
61483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61484                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61485                 ret_arr_ptr[n] = ret_conv_13_ref;
61486         }
61487         
61488         FREE(ret_var.data);
61489         return ret_arr;
61490 }
61491
61492 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
61493         LDKRefund this_arg_conv;
61494         this_arg_conv.inner = untag_ptr(this_arg);
61495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61497         this_arg_conv.is_owned = false;
61498         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
61499         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61500         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61501         return ret_arr;
61502 }
61503
61504 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
61505         LDKRefund this_arg_conv;
61506         this_arg_conv.inner = untag_ptr(this_arg);
61507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61509         this_arg_conv.is_owned = false;
61510         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61511         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
61512         return ret_arr;
61513 }
61514
61515 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
61516         LDKRefund this_arg_conv;
61517         this_arg_conv.inner = untag_ptr(this_arg);
61518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61520         this_arg_conv.is_owned = false;
61521         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
61522         return ret_conv;
61523 }
61524
61525 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
61526         LDKRefund this_arg_conv;
61527         this_arg_conv.inner = untag_ptr(this_arg);
61528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61530         this_arg_conv.is_owned = false;
61531         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
61532         uint64_t ret_ref = 0;
61533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61535         return ret_ref;
61536 }
61537
61538 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
61539         LDKRefund this_arg_conv;
61540         this_arg_conv.inner = untag_ptr(this_arg);
61541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61543         this_arg_conv.is_owned = false;
61544         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61545         *ret_copy = Refund_quantity(&this_arg_conv);
61546         uint64_t ret_ref = tag_ptr(ret_copy, true);
61547         return ret_ref;
61548 }
61549
61550 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
61551         LDKRefund this_arg_conv;
61552         this_arg_conv.inner = untag_ptr(this_arg);
61553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61555         this_arg_conv.is_owned = false;
61556         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61557         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
61558         return ret_arr;
61559 }
61560
61561 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
61562         LDKRefund this_arg_conv;
61563         this_arg_conv.inner = untag_ptr(this_arg);
61564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61566         this_arg_conv.is_owned = false;
61567         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
61568         uint64_t ret_ref = 0;
61569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61571         return ret_ref;
61572 }
61573
61574 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
61575         LDKRefund obj_conv;
61576         obj_conv.inner = untag_ptr(obj);
61577         obj_conv.is_owned = ptr_is_owned(obj);
61578         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61579         obj_conv.is_owned = false;
61580         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
61581         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61582         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61583         CVec_u8Z_free(ret_var);
61584         return ret_arr;
61585 }
61586
61587 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
61588         LDKStr s_conv = str_ref_to_owned_c(s);
61589         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
61590         *ret_conv = Refund_from_str(s_conv);
61591         return tag_ptr(ret_conv, true);
61592 }
61593
61594 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
61595         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
61596         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
61597         return ret_conv;
61598 }
61599
61600 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
61601         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
61602         return ret_conv;
61603 }
61604
61605 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
61606         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
61607         return ret_conv;
61608 }
61609
61610 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
61611         if (!ptr_is_owned(this_ptr)) return;
61612         void* this_ptr_ptr = untag_ptr(this_ptr);
61613         CHECK_ACCESS(this_ptr_ptr);
61614         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
61615         FREE(untag_ptr(this_ptr));
61616         UtxoResult_free(this_ptr_conv);
61617 }
61618
61619 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
61620         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61621         *ret_copy = UtxoResult_clone(arg);
61622         uint64_t ret_ref = tag_ptr(ret_copy, true);
61623         return ret_ref;
61624 }
61625 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
61626         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
61627         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
61628         return ret_conv;
61629 }
61630
61631 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
61632         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
61633         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61634         *ret_copy = UtxoResult_clone(orig_conv);
61635         uint64_t ret_ref = tag_ptr(ret_copy, true);
61636         return ret_ref;
61637 }
61638
61639 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
61640         void* a_ptr = untag_ptr(a);
61641         CHECK_ACCESS(a_ptr);
61642         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
61643         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
61644         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61645         *ret_copy = UtxoResult_sync(a_conv);
61646         uint64_t ret_ref = tag_ptr(ret_copy, true);
61647         return ret_ref;
61648 }
61649
61650 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
61651         LDKUtxoFuture a_conv;
61652         a_conv.inner = untag_ptr(a);
61653         a_conv.is_owned = ptr_is_owned(a);
61654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61655         a_conv = UtxoFuture_clone(&a_conv);
61656         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61657         *ret_copy = UtxoResult_async(a_conv);
61658         uint64_t ret_ref = tag_ptr(ret_copy, true);
61659         return ret_ref;
61660 }
61661
61662 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
61663         if (!ptr_is_owned(this_ptr)) return;
61664         void* this_ptr_ptr = untag_ptr(this_ptr);
61665         CHECK_ACCESS(this_ptr_ptr);
61666         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
61667         FREE(untag_ptr(this_ptr));
61668         UtxoLookup_free(this_ptr_conv);
61669 }
61670
61671 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
61672         LDKUtxoFuture this_obj_conv;
61673         this_obj_conv.inner = untag_ptr(this_obj);
61674         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61676         UtxoFuture_free(this_obj_conv);
61677 }
61678
61679 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
61680         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
61681         uint64_t ret_ref = 0;
61682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61684         return ret_ref;
61685 }
61686 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
61687         LDKUtxoFuture arg_conv;
61688         arg_conv.inner = untag_ptr(arg);
61689         arg_conv.is_owned = ptr_is_owned(arg);
61690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61691         arg_conv.is_owned = false;
61692         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
61693         return ret_conv;
61694 }
61695
61696 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
61697         LDKUtxoFuture orig_conv;
61698         orig_conv.inner = untag_ptr(orig);
61699         orig_conv.is_owned = ptr_is_owned(orig);
61700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61701         orig_conv.is_owned = false;
61702         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
61703         uint64_t ret_ref = 0;
61704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61706         return ret_ref;
61707 }
61708
61709 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
61710         LDKUtxoFuture ret_var = UtxoFuture_new();
61711         uint64_t ret_ref = 0;
61712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61714         return ret_ref;
61715 }
61716
61717 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
61718         LDKUtxoFuture this_arg_conv;
61719         this_arg_conv.inner = untag_ptr(this_arg);
61720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61722         this_arg_conv.is_owned = false;
61723         LDKNetworkGraph graph_conv;
61724         graph_conv.inner = untag_ptr(graph);
61725         graph_conv.is_owned = ptr_is_owned(graph);
61726         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61727         graph_conv.is_owned = false;
61728         void* result_ptr = untag_ptr(result);
61729         CHECK_ACCESS(result_ptr);
61730         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61731         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
61732 }
61733
61734 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
61735         LDKUtxoFuture this_arg_conv;
61736         this_arg_conv.inner = untag_ptr(this_arg);
61737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61739         this_arg_conv.is_owned = false;
61740         LDKNetworkGraph graph_conv;
61741         graph_conv.inner = untag_ptr(graph);
61742         graph_conv.is_owned = ptr_is_owned(graph);
61743         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61744         graph_conv.is_owned = false;
61745         LDKP2PGossipSync gossip_conv;
61746         gossip_conv.inner = untag_ptr(gossip);
61747         gossip_conv.is_owned = ptr_is_owned(gossip);
61748         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
61749         gossip_conv.is_owned = false;
61750         void* result_ptr = untag_ptr(result);
61751         CHECK_ACCESS(result_ptr);
61752         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61753         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
61754 }
61755
61756 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
61757         LDKNodeId this_obj_conv;
61758         this_obj_conv.inner = untag_ptr(this_obj);
61759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61761         NodeId_free(this_obj_conv);
61762 }
61763
61764 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
61765         LDKNodeId ret_var = NodeId_clone(arg);
61766         uint64_t ret_ref = 0;
61767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61769         return ret_ref;
61770 }
61771 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
61772         LDKNodeId arg_conv;
61773         arg_conv.inner = untag_ptr(arg);
61774         arg_conv.is_owned = ptr_is_owned(arg);
61775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61776         arg_conv.is_owned = false;
61777         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
61778         return ret_conv;
61779 }
61780
61781 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
61782         LDKNodeId orig_conv;
61783         orig_conv.inner = untag_ptr(orig);
61784         orig_conv.is_owned = ptr_is_owned(orig);
61785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61786         orig_conv.is_owned = false;
61787         LDKNodeId ret_var = NodeId_clone(&orig_conv);
61788         uint64_t ret_ref = 0;
61789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61791         return ret_ref;
61792 }
61793
61794 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
61795         LDKPublicKey pubkey_ref;
61796         CHECK(pubkey->arr_len == 33);
61797         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
61798         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
61799         uint64_t ret_ref = 0;
61800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61802         return ret_ref;
61803 }
61804
61805 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
61806         LDKNodeId this_arg_conv;
61807         this_arg_conv.inner = untag_ptr(this_arg);
61808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61810         this_arg_conv.is_owned = false;
61811         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
61812         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61813         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61814         return ret_arr;
61815 }
61816
61817 int8_tArray  __attribute__((export_name("TS_NodeId_as_array"))) TS_NodeId_as_array(uint64_t this_arg) {
61818         LDKNodeId this_arg_conv;
61819         this_arg_conv.inner = untag_ptr(this_arg);
61820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61822         this_arg_conv.is_owned = false;
61823         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61824         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
61825         return ret_arr;
61826 }
61827
61828 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
61829         LDKNodeId this_arg_conv;
61830         this_arg_conv.inner = untag_ptr(this_arg);
61831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61833         this_arg_conv.is_owned = false;
61834         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61835         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
61836         return tag_ptr(ret_conv, true);
61837 }
61838
61839 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
61840         LDKNodeId o_conv;
61841         o_conv.inner = untag_ptr(o);
61842         o_conv.is_owned = ptr_is_owned(o);
61843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61844         o_conv.is_owned = false;
61845         int64_t ret_conv = NodeId_hash(&o_conv);
61846         return ret_conv;
61847 }
61848
61849 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
61850         LDKNodeId obj_conv;
61851         obj_conv.inner = untag_ptr(obj);
61852         obj_conv.is_owned = ptr_is_owned(obj);
61853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61854         obj_conv.is_owned = false;
61855         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
61856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61858         CVec_u8Z_free(ret_var);
61859         return ret_arr;
61860 }
61861
61862 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
61863         LDKu8slice ser_ref;
61864         ser_ref.datalen = ser->arr_len;
61865         ser_ref.data = ser->elems;
61866         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
61867         *ret_conv = NodeId_read(ser_ref);
61868         FREE(ser);
61869         return tag_ptr(ret_conv, true);
61870 }
61871
61872 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
61873         LDKNetworkGraph this_obj_conv;
61874         this_obj_conv.inner = untag_ptr(this_obj);
61875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61877         NetworkGraph_free(this_obj_conv);
61878 }
61879
61880 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
61881         LDKReadOnlyNetworkGraph this_obj_conv;
61882         this_obj_conv.inner = untag_ptr(this_obj);
61883         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61885         ReadOnlyNetworkGraph_free(this_obj_conv);
61886 }
61887
61888 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
61889         if (!ptr_is_owned(this_ptr)) return;
61890         void* this_ptr_ptr = untag_ptr(this_ptr);
61891         CHECK_ACCESS(this_ptr_ptr);
61892         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
61893         FREE(untag_ptr(this_ptr));
61894         NetworkUpdate_free(this_ptr_conv);
61895 }
61896
61897 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
61898         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61899         *ret_copy = NetworkUpdate_clone(arg);
61900         uint64_t ret_ref = tag_ptr(ret_copy, true);
61901         return ret_ref;
61902 }
61903 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
61904         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
61905         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
61906         return ret_conv;
61907 }
61908
61909 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
61910         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
61911         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61912         *ret_copy = NetworkUpdate_clone(orig_conv);
61913         uint64_t ret_ref = tag_ptr(ret_copy, true);
61914         return ret_ref;
61915 }
61916
61917 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
61918         LDKChannelUpdate msg_conv;
61919         msg_conv.inner = untag_ptr(msg);
61920         msg_conv.is_owned = ptr_is_owned(msg);
61921         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61922         msg_conv = ChannelUpdate_clone(&msg_conv);
61923         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61924         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
61925         uint64_t ret_ref = tag_ptr(ret_copy, true);
61926         return ret_ref;
61927 }
61928
61929 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
61930         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61931         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
61932         uint64_t ret_ref = tag_ptr(ret_copy, true);
61933         return ret_ref;
61934 }
61935
61936 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
61937         LDKPublicKey node_id_ref;
61938         CHECK(node_id->arr_len == 33);
61939         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
61940         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61941         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
61942         uint64_t ret_ref = tag_ptr(ret_copy, true);
61943         return ret_ref;
61944 }
61945
61946 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
61947         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
61948         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
61949         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
61950         return ret_conv;
61951 }
61952
61953 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
61954         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
61955         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
61956         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61957         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61958         CVec_u8Z_free(ret_var);
61959         return ret_arr;
61960 }
61961
61962 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
61963         LDKu8slice ser_ref;
61964         ser_ref.datalen = ser->arr_len;
61965         ser_ref.data = ser->elems;
61966         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
61967         *ret_conv = NetworkUpdate_read(ser_ref);
61968         FREE(ser);
61969         return tag_ptr(ret_conv, true);
61970 }
61971
61972 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
61973         LDKP2PGossipSync this_obj_conv;
61974         this_obj_conv.inner = untag_ptr(this_obj);
61975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61977         P2PGossipSync_free(this_obj_conv);
61978 }
61979
61980 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
61981         LDKNetworkGraph network_graph_conv;
61982         network_graph_conv.inner = untag_ptr(network_graph);
61983         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61984         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61985         network_graph_conv.is_owned = false;
61986         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61987         CHECK_ACCESS(utxo_lookup_ptr);
61988         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61989         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61990         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61991                 // Manually implement clone for Java trait instances
61992                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61993                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61994                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61995                 }
61996         }
61997         void* logger_ptr = untag_ptr(logger);
61998         CHECK_ACCESS(logger_ptr);
61999         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62000         if (logger_conv.free == LDKLogger_JCalls_free) {
62001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62002                 LDKLogger_JCalls_cloned(&logger_conv);
62003         }
62004         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
62005         uint64_t ret_ref = 0;
62006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62008         return ret_ref;
62009 }
62010
62011 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
62012         LDKP2PGossipSync this_arg_conv;
62013         this_arg_conv.inner = untag_ptr(this_arg);
62014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62016         this_arg_conv.is_owned = false;
62017         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62018         CHECK_ACCESS(utxo_lookup_ptr);
62019         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62020         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62021         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62022                 // Manually implement clone for Java trait instances
62023                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62024                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62025                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62026                 }
62027         }
62028         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
62029 }
62030
62031 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
62032         LDKNetworkGraph this_arg_conv;
62033         this_arg_conv.inner = untag_ptr(this_arg);
62034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62036         this_arg_conv.is_owned = false;
62037         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
62038         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
62039 }
62040
62041 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
62042         LDKNetworkGraph this_arg_conv;
62043         this_arg_conv.inner = untag_ptr(this_arg);
62044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62046         this_arg_conv.is_owned = false;
62047         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62048         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
62049         return ret_arr;
62050 }
62051
62052 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
62053         LDKNodeAnnouncement msg_conv;
62054         msg_conv.inner = untag_ptr(msg);
62055         msg_conv.is_owned = ptr_is_owned(msg);
62056         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62057         msg_conv.is_owned = false;
62058         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62059         *ret_conv = verify_node_announcement(&msg_conv);
62060         return tag_ptr(ret_conv, true);
62061 }
62062
62063 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
62064         LDKChannelAnnouncement msg_conv;
62065         msg_conv.inner = untag_ptr(msg);
62066         msg_conv.is_owned = ptr_is_owned(msg);
62067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62068         msg_conv.is_owned = false;
62069         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62070         *ret_conv = verify_channel_announcement(&msg_conv);
62071         return tag_ptr(ret_conv, true);
62072 }
62073
62074 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
62075         LDKP2PGossipSync this_arg_conv;
62076         this_arg_conv.inner = untag_ptr(this_arg);
62077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62079         this_arg_conv.is_owned = false;
62080         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
62081         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
62082         return tag_ptr(ret_ret, true);
62083 }
62084
62085 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
62086         LDKP2PGossipSync this_arg_conv;
62087         this_arg_conv.inner = untag_ptr(this_arg);
62088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62090         this_arg_conv.is_owned = false;
62091         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
62092         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
62093         return tag_ptr(ret_ret, true);
62094 }
62095
62096 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
62097         LDKChannelUpdateInfo this_obj_conv;
62098         this_obj_conv.inner = untag_ptr(this_obj);
62099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62101         ChannelUpdateInfo_free(this_obj_conv);
62102 }
62103
62104 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
62105         LDKChannelUpdateInfo this_ptr_conv;
62106         this_ptr_conv.inner = untag_ptr(this_ptr);
62107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62109         this_ptr_conv.is_owned = false;
62110         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
62111         return ret_conv;
62112 }
62113
62114 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
62115         LDKChannelUpdateInfo this_ptr_conv;
62116         this_ptr_conv.inner = untag_ptr(this_ptr);
62117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62119         this_ptr_conv.is_owned = false;
62120         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
62121 }
62122
62123 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
62124         LDKChannelUpdateInfo this_ptr_conv;
62125         this_ptr_conv.inner = untag_ptr(this_ptr);
62126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62128         this_ptr_conv.is_owned = false;
62129         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
62130         return ret_conv;
62131 }
62132
62133 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
62134         LDKChannelUpdateInfo this_ptr_conv;
62135         this_ptr_conv.inner = untag_ptr(this_ptr);
62136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62138         this_ptr_conv.is_owned = false;
62139         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
62140 }
62141
62142 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
62143         LDKChannelUpdateInfo 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         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
62149         return ret_conv;
62150 }
62151
62152 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
62153         LDKChannelUpdateInfo this_ptr_conv;
62154         this_ptr_conv.inner = untag_ptr(this_ptr);
62155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62157         this_ptr_conv.is_owned = false;
62158         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
62159 }
62160
62161 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
62162         LDKChannelUpdateInfo this_ptr_conv;
62163         this_ptr_conv.inner = untag_ptr(this_ptr);
62164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62166         this_ptr_conv.is_owned = false;
62167         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
62168         return ret_conv;
62169 }
62170
62171 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
62172         LDKChannelUpdateInfo this_ptr_conv;
62173         this_ptr_conv.inner = untag_ptr(this_ptr);
62174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62176         this_ptr_conv.is_owned = false;
62177         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
62178 }
62179
62180 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
62181         LDKChannelUpdateInfo this_ptr_conv;
62182         this_ptr_conv.inner = untag_ptr(this_ptr);
62183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62185         this_ptr_conv.is_owned = false;
62186         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
62187         return ret_conv;
62188 }
62189
62190 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
62191         LDKChannelUpdateInfo this_ptr_conv;
62192         this_ptr_conv.inner = untag_ptr(this_ptr);
62193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62195         this_ptr_conv.is_owned = false;
62196         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
62197 }
62198
62199 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
62200         LDKChannelUpdateInfo this_ptr_conv;
62201         this_ptr_conv.inner = untag_ptr(this_ptr);
62202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62204         this_ptr_conv.is_owned = false;
62205         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
62206         uint64_t ret_ref = 0;
62207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62209         return ret_ref;
62210 }
62211
62212 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
62213         LDKChannelUpdateInfo this_ptr_conv;
62214         this_ptr_conv.inner = untag_ptr(this_ptr);
62215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62217         this_ptr_conv.is_owned = false;
62218         LDKRoutingFees val_conv;
62219         val_conv.inner = untag_ptr(val);
62220         val_conv.is_owned = ptr_is_owned(val);
62221         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62222         val_conv = RoutingFees_clone(&val_conv);
62223         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
62224 }
62225
62226 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
62227         LDKChannelUpdateInfo this_ptr_conv;
62228         this_ptr_conv.inner = untag_ptr(this_ptr);
62229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62231         this_ptr_conv.is_owned = false;
62232         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
62233         uint64_t ret_ref = 0;
62234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62236         return ret_ref;
62237 }
62238
62239 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
62240         LDKChannelUpdateInfo this_ptr_conv;
62241         this_ptr_conv.inner = untag_ptr(this_ptr);
62242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62244         this_ptr_conv.is_owned = false;
62245         LDKChannelUpdate val_conv;
62246         val_conv.inner = untag_ptr(val);
62247         val_conv.is_owned = ptr_is_owned(val);
62248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62249         val_conv = ChannelUpdate_clone(&val_conv);
62250         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
62251 }
62252
62253 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) {
62254         LDKRoutingFees fees_arg_conv;
62255         fees_arg_conv.inner = untag_ptr(fees_arg);
62256         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
62257         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
62258         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
62259         LDKChannelUpdate last_update_message_arg_conv;
62260         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
62261         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
62262         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
62263         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
62264         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);
62265         uint64_t ret_ref = 0;
62266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62268         return ret_ref;
62269 }
62270
62271 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
62272         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
62273         uint64_t ret_ref = 0;
62274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62276         return ret_ref;
62277 }
62278 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
62279         LDKChannelUpdateInfo arg_conv;
62280         arg_conv.inner = untag_ptr(arg);
62281         arg_conv.is_owned = ptr_is_owned(arg);
62282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62283         arg_conv.is_owned = false;
62284         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
62285         return ret_conv;
62286 }
62287
62288 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
62289         LDKChannelUpdateInfo orig_conv;
62290         orig_conv.inner = untag_ptr(orig);
62291         orig_conv.is_owned = ptr_is_owned(orig);
62292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62293         orig_conv.is_owned = false;
62294         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
62295         uint64_t ret_ref = 0;
62296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62298         return ret_ref;
62299 }
62300
62301 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
62302         LDKChannelUpdateInfo a_conv;
62303         a_conv.inner = untag_ptr(a);
62304         a_conv.is_owned = ptr_is_owned(a);
62305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62306         a_conv.is_owned = false;
62307         LDKChannelUpdateInfo b_conv;
62308         b_conv.inner = untag_ptr(b);
62309         b_conv.is_owned = ptr_is_owned(b);
62310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62311         b_conv.is_owned = false;
62312         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
62313         return ret_conv;
62314 }
62315
62316 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
62317         LDKChannelUpdateInfo obj_conv;
62318         obj_conv.inner = untag_ptr(obj);
62319         obj_conv.is_owned = ptr_is_owned(obj);
62320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62321         obj_conv.is_owned = false;
62322         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
62323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62325         CVec_u8Z_free(ret_var);
62326         return ret_arr;
62327 }
62328
62329 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
62330         LDKu8slice ser_ref;
62331         ser_ref.datalen = ser->arr_len;
62332         ser_ref.data = ser->elems;
62333         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
62334         *ret_conv = ChannelUpdateInfo_read(ser_ref);
62335         FREE(ser);
62336         return tag_ptr(ret_conv, true);
62337 }
62338
62339 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
62340         LDKChannelInfo this_obj_conv;
62341         this_obj_conv.inner = untag_ptr(this_obj);
62342         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62344         ChannelInfo_free(this_obj_conv);
62345 }
62346
62347 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
62348         LDKChannelInfo this_ptr_conv;
62349         this_ptr_conv.inner = untag_ptr(this_ptr);
62350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62352         this_ptr_conv.is_owned = false;
62353         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
62354         uint64_t ret_ref = 0;
62355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62357         return ret_ref;
62358 }
62359
62360 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
62361         LDKChannelInfo this_ptr_conv;
62362         this_ptr_conv.inner = untag_ptr(this_ptr);
62363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62365         this_ptr_conv.is_owned = false;
62366         LDKChannelFeatures val_conv;
62367         val_conv.inner = untag_ptr(val);
62368         val_conv.is_owned = ptr_is_owned(val);
62369         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62370         val_conv = ChannelFeatures_clone(&val_conv);
62371         ChannelInfo_set_features(&this_ptr_conv, val_conv);
62372 }
62373
62374 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
62375         LDKChannelInfo this_ptr_conv;
62376         this_ptr_conv.inner = untag_ptr(this_ptr);
62377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62379         this_ptr_conv.is_owned = false;
62380         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
62381         uint64_t ret_ref = 0;
62382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62384         return ret_ref;
62385 }
62386
62387 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
62388         LDKChannelInfo this_ptr_conv;
62389         this_ptr_conv.inner = untag_ptr(this_ptr);
62390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62392         this_ptr_conv.is_owned = false;
62393         LDKNodeId val_conv;
62394         val_conv.inner = untag_ptr(val);
62395         val_conv.is_owned = ptr_is_owned(val);
62396         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62397         val_conv = NodeId_clone(&val_conv);
62398         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
62399 }
62400
62401 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
62402         LDKChannelInfo 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         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
62408         uint64_t ret_ref = 0;
62409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62411         return ret_ref;
62412 }
62413
62414 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
62415         LDKChannelInfo this_ptr_conv;
62416         this_ptr_conv.inner = untag_ptr(this_ptr);
62417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62419         this_ptr_conv.is_owned = false;
62420         LDKChannelUpdateInfo val_conv;
62421         val_conv.inner = untag_ptr(val);
62422         val_conv.is_owned = ptr_is_owned(val);
62423         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62424         val_conv = ChannelUpdateInfo_clone(&val_conv);
62425         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
62426 }
62427
62428 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
62429         LDKChannelInfo this_ptr_conv;
62430         this_ptr_conv.inner = untag_ptr(this_ptr);
62431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62433         this_ptr_conv.is_owned = false;
62434         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
62435         uint64_t ret_ref = 0;
62436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62438         return ret_ref;
62439 }
62440
62441 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
62442         LDKChannelInfo this_ptr_conv;
62443         this_ptr_conv.inner = untag_ptr(this_ptr);
62444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62446         this_ptr_conv.is_owned = false;
62447         LDKNodeId val_conv;
62448         val_conv.inner = untag_ptr(val);
62449         val_conv.is_owned = ptr_is_owned(val);
62450         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62451         val_conv = NodeId_clone(&val_conv);
62452         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
62453 }
62454
62455 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
62456         LDKChannelInfo this_ptr_conv;
62457         this_ptr_conv.inner = untag_ptr(this_ptr);
62458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62460         this_ptr_conv.is_owned = false;
62461         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
62462         uint64_t ret_ref = 0;
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62465         return ret_ref;
62466 }
62467
62468 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
62469         LDKChannelInfo this_ptr_conv;
62470         this_ptr_conv.inner = untag_ptr(this_ptr);
62471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62473         this_ptr_conv.is_owned = false;
62474         LDKChannelUpdateInfo val_conv;
62475         val_conv.inner = untag_ptr(val);
62476         val_conv.is_owned = ptr_is_owned(val);
62477         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62478         val_conv = ChannelUpdateInfo_clone(&val_conv);
62479         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
62480 }
62481
62482 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
62483         LDKChannelInfo this_ptr_conv;
62484         this_ptr_conv.inner = untag_ptr(this_ptr);
62485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62487         this_ptr_conv.is_owned = false;
62488         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
62489         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
62490         uint64_t ret_ref = tag_ptr(ret_copy, true);
62491         return ret_ref;
62492 }
62493
62494 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
62495         LDKChannelInfo this_ptr_conv;
62496         this_ptr_conv.inner = untag_ptr(this_ptr);
62497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62499         this_ptr_conv.is_owned = false;
62500         void* val_ptr = untag_ptr(val);
62501         CHECK_ACCESS(val_ptr);
62502         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
62503         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
62504         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
62505 }
62506
62507 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
62508         LDKChannelInfo this_ptr_conv;
62509         this_ptr_conv.inner = untag_ptr(this_ptr);
62510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62512         this_ptr_conv.is_owned = false;
62513         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
62514         uint64_t ret_ref = 0;
62515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62517         return ret_ref;
62518 }
62519
62520 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
62521         LDKChannelInfo this_ptr_conv;
62522         this_ptr_conv.inner = untag_ptr(this_ptr);
62523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62525         this_ptr_conv.is_owned = false;
62526         LDKChannelAnnouncement val_conv;
62527         val_conv.inner = untag_ptr(val);
62528         val_conv.is_owned = ptr_is_owned(val);
62529         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62530         val_conv = ChannelAnnouncement_clone(&val_conv);
62531         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
62532 }
62533
62534 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
62535         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
62536         uint64_t ret_ref = 0;
62537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62539         return ret_ref;
62540 }
62541 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
62542         LDKChannelInfo arg_conv;
62543         arg_conv.inner = untag_ptr(arg);
62544         arg_conv.is_owned = ptr_is_owned(arg);
62545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62546         arg_conv.is_owned = false;
62547         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
62548         return ret_conv;
62549 }
62550
62551 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
62552         LDKChannelInfo orig_conv;
62553         orig_conv.inner = untag_ptr(orig);
62554         orig_conv.is_owned = ptr_is_owned(orig);
62555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62556         orig_conv.is_owned = false;
62557         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
62558         uint64_t ret_ref = 0;
62559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62561         return ret_ref;
62562 }
62563
62564 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
62565         LDKChannelInfo a_conv;
62566         a_conv.inner = untag_ptr(a);
62567         a_conv.is_owned = ptr_is_owned(a);
62568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62569         a_conv.is_owned = false;
62570         LDKChannelInfo b_conv;
62571         b_conv.inner = untag_ptr(b);
62572         b_conv.is_owned = ptr_is_owned(b);
62573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62574         b_conv.is_owned = false;
62575         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
62576         return ret_conv;
62577 }
62578
62579 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
62580         LDKChannelInfo this_arg_conv;
62581         this_arg_conv.inner = untag_ptr(this_arg);
62582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62584         this_arg_conv.is_owned = false;
62585         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
62586         uint64_t ret_ref = 0;
62587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62589         return ret_ref;
62590 }
62591
62592 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
62593         LDKChannelInfo obj_conv;
62594         obj_conv.inner = untag_ptr(obj);
62595         obj_conv.is_owned = ptr_is_owned(obj);
62596         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62597         obj_conv.is_owned = false;
62598         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
62599         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62600         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62601         CVec_u8Z_free(ret_var);
62602         return ret_arr;
62603 }
62604
62605 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
62606         LDKu8slice ser_ref;
62607         ser_ref.datalen = ser->arr_len;
62608         ser_ref.data = ser->elems;
62609         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
62610         *ret_conv = ChannelInfo_read(ser_ref);
62611         FREE(ser);
62612         return tag_ptr(ret_conv, true);
62613 }
62614
62615 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
62616         LDKDirectedChannelInfo this_obj_conv;
62617         this_obj_conv.inner = untag_ptr(this_obj);
62618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62620         DirectedChannelInfo_free(this_obj_conv);
62621 }
62622
62623 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
62624         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
62625         uint64_t ret_ref = 0;
62626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62628         return ret_ref;
62629 }
62630 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
62631         LDKDirectedChannelInfo arg_conv;
62632         arg_conv.inner = untag_ptr(arg);
62633         arg_conv.is_owned = ptr_is_owned(arg);
62634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62635         arg_conv.is_owned = false;
62636         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
62637         return ret_conv;
62638 }
62639
62640 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
62641         LDKDirectedChannelInfo orig_conv;
62642         orig_conv.inner = untag_ptr(orig);
62643         orig_conv.is_owned = ptr_is_owned(orig);
62644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62645         orig_conv.is_owned = false;
62646         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
62647         uint64_t ret_ref = 0;
62648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62650         return ret_ref;
62651 }
62652
62653 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
62654         LDKDirectedChannelInfo this_arg_conv;
62655         this_arg_conv.inner = untag_ptr(this_arg);
62656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62658         this_arg_conv.is_owned = false;
62659         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
62660         uint64_t ret_ref = 0;
62661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62663         return ret_ref;
62664 }
62665
62666 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
62667         LDKDirectedChannelInfo this_arg_conv;
62668         this_arg_conv.inner = untag_ptr(this_arg);
62669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62671         this_arg_conv.is_owned = false;
62672         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62673         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
62674         uint64_t ret_ref = tag_ptr(ret_copy, true);
62675         return ret_ref;
62676 }
62677
62678 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
62679         if (!ptr_is_owned(this_ptr)) return;
62680         void* this_ptr_ptr = untag_ptr(this_ptr);
62681         CHECK_ACCESS(this_ptr_ptr);
62682         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
62683         FREE(untag_ptr(this_ptr));
62684         EffectiveCapacity_free(this_ptr_conv);
62685 }
62686
62687 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
62688         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62689         *ret_copy = EffectiveCapacity_clone(arg);
62690         uint64_t ret_ref = tag_ptr(ret_copy, true);
62691         return ret_ref;
62692 }
62693 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
62694         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
62695         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
62696         return ret_conv;
62697 }
62698
62699 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
62700         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
62701         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62702         *ret_copy = EffectiveCapacity_clone(orig_conv);
62703         uint64_t ret_ref = tag_ptr(ret_copy, true);
62704         return ret_ref;
62705 }
62706
62707 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
62708         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62709         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
62710         uint64_t ret_ref = tag_ptr(ret_copy, true);
62711         return ret_ref;
62712 }
62713
62714 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
62715         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62716         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
62717         uint64_t ret_ref = tag_ptr(ret_copy, true);
62718         return ret_ref;
62719 }
62720
62721 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
62722         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62723         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
62724         uint64_t ret_ref = tag_ptr(ret_copy, true);
62725         return ret_ref;
62726 }
62727
62728 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
62729         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62730         *ret_copy = EffectiveCapacity_infinite();
62731         uint64_t ret_ref = tag_ptr(ret_copy, true);
62732         return ret_ref;
62733 }
62734
62735 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
62736         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62737         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
62738         uint64_t ret_ref = tag_ptr(ret_copy, true);
62739         return ret_ref;
62740 }
62741
62742 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
62743         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62744         *ret_copy = EffectiveCapacity_unknown();
62745         uint64_t ret_ref = tag_ptr(ret_copy, true);
62746         return ret_ref;
62747 }
62748
62749 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
62750         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
62751         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
62752         return ret_conv;
62753 }
62754
62755 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
62756         LDKRoutingFees this_obj_conv;
62757         this_obj_conv.inner = untag_ptr(this_obj);
62758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62760         RoutingFees_free(this_obj_conv);
62761 }
62762
62763 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
62764         LDKRoutingFees this_ptr_conv;
62765         this_ptr_conv.inner = untag_ptr(this_ptr);
62766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62768         this_ptr_conv.is_owned = false;
62769         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
62770         return ret_conv;
62771 }
62772
62773 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
62774         LDKRoutingFees this_ptr_conv;
62775         this_ptr_conv.inner = untag_ptr(this_ptr);
62776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62778         this_ptr_conv.is_owned = false;
62779         RoutingFees_set_base_msat(&this_ptr_conv, val);
62780 }
62781
62782 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
62783         LDKRoutingFees this_ptr_conv;
62784         this_ptr_conv.inner = untag_ptr(this_ptr);
62785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62787         this_ptr_conv.is_owned = false;
62788         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
62789         return ret_conv;
62790 }
62791
62792 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
62793         LDKRoutingFees this_ptr_conv;
62794         this_ptr_conv.inner = untag_ptr(this_ptr);
62795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62797         this_ptr_conv.is_owned = false;
62798         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
62799 }
62800
62801 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
62802         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
62803         uint64_t ret_ref = 0;
62804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62806         return ret_ref;
62807 }
62808
62809 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
62810         LDKRoutingFees a_conv;
62811         a_conv.inner = untag_ptr(a);
62812         a_conv.is_owned = ptr_is_owned(a);
62813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62814         a_conv.is_owned = false;
62815         LDKRoutingFees b_conv;
62816         b_conv.inner = untag_ptr(b);
62817         b_conv.is_owned = ptr_is_owned(b);
62818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62819         b_conv.is_owned = false;
62820         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
62821         return ret_conv;
62822 }
62823
62824 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
62825         LDKRoutingFees ret_var = RoutingFees_clone(arg);
62826         uint64_t ret_ref = 0;
62827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62829         return ret_ref;
62830 }
62831 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
62832         LDKRoutingFees arg_conv;
62833         arg_conv.inner = untag_ptr(arg);
62834         arg_conv.is_owned = ptr_is_owned(arg);
62835         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62836         arg_conv.is_owned = false;
62837         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
62838         return ret_conv;
62839 }
62840
62841 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
62842         LDKRoutingFees orig_conv;
62843         orig_conv.inner = untag_ptr(orig);
62844         orig_conv.is_owned = ptr_is_owned(orig);
62845         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62846         orig_conv.is_owned = false;
62847         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
62848         uint64_t ret_ref = 0;
62849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62851         return ret_ref;
62852 }
62853
62854 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
62855         LDKRoutingFees o_conv;
62856         o_conv.inner = untag_ptr(o);
62857         o_conv.is_owned = ptr_is_owned(o);
62858         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62859         o_conv.is_owned = false;
62860         int64_t ret_conv = RoutingFees_hash(&o_conv);
62861         return ret_conv;
62862 }
62863
62864 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
62865         LDKRoutingFees obj_conv;
62866         obj_conv.inner = untag_ptr(obj);
62867         obj_conv.is_owned = ptr_is_owned(obj);
62868         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62869         obj_conv.is_owned = false;
62870         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
62871         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62872         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62873         CVec_u8Z_free(ret_var);
62874         return ret_arr;
62875 }
62876
62877 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
62878         LDKu8slice ser_ref;
62879         ser_ref.datalen = ser->arr_len;
62880         ser_ref.data = ser->elems;
62881         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
62882         *ret_conv = RoutingFees_read(ser_ref);
62883         FREE(ser);
62884         return tag_ptr(ret_conv, true);
62885 }
62886
62887 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
62888         LDKNodeAnnouncementInfo this_obj_conv;
62889         this_obj_conv.inner = untag_ptr(this_obj);
62890         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62892         NodeAnnouncementInfo_free(this_obj_conv);
62893 }
62894
62895 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
62896         LDKNodeAnnouncementInfo this_ptr_conv;
62897         this_ptr_conv.inner = untag_ptr(this_ptr);
62898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62900         this_ptr_conv.is_owned = false;
62901         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
62902         uint64_t ret_ref = 0;
62903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62905         return ret_ref;
62906 }
62907
62908 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
62909         LDKNodeAnnouncementInfo this_ptr_conv;
62910         this_ptr_conv.inner = untag_ptr(this_ptr);
62911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62913         this_ptr_conv.is_owned = false;
62914         LDKNodeFeatures val_conv;
62915         val_conv.inner = untag_ptr(val);
62916         val_conv.is_owned = ptr_is_owned(val);
62917         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62918         val_conv = NodeFeatures_clone(&val_conv);
62919         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
62920 }
62921
62922 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
62923         LDKNodeAnnouncementInfo this_ptr_conv;
62924         this_ptr_conv.inner = untag_ptr(this_ptr);
62925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62927         this_ptr_conv.is_owned = false;
62928         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
62929         return ret_conv;
62930 }
62931
62932 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
62933         LDKNodeAnnouncementInfo this_ptr_conv;
62934         this_ptr_conv.inner = untag_ptr(this_ptr);
62935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62937         this_ptr_conv.is_owned = false;
62938         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
62939 }
62940
62941 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
62942         LDKNodeAnnouncementInfo this_ptr_conv;
62943         this_ptr_conv.inner = untag_ptr(this_ptr);
62944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62946         this_ptr_conv.is_owned = false;
62947         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
62948         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
62949         return ret_arr;
62950 }
62951
62952 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
62953         LDKNodeAnnouncementInfo this_ptr_conv;
62954         this_ptr_conv.inner = untag_ptr(this_ptr);
62955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62957         this_ptr_conv.is_owned = false;
62958         LDKThreeBytes val_ref;
62959         CHECK(val->arr_len == 3);
62960         memcpy(val_ref.data, val->elems, 3); FREE(val);
62961         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
62962 }
62963
62964 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
62965         LDKNodeAnnouncementInfo this_ptr_conv;
62966         this_ptr_conv.inner = untag_ptr(this_ptr);
62967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62969         this_ptr_conv.is_owned = false;
62970         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
62971         uint64_t ret_ref = 0;
62972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62974         return ret_ref;
62975 }
62976
62977 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
62978         LDKNodeAnnouncementInfo this_ptr_conv;
62979         this_ptr_conv.inner = untag_ptr(this_ptr);
62980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62982         this_ptr_conv.is_owned = false;
62983         LDKNodeAlias val_conv;
62984         val_conv.inner = untag_ptr(val);
62985         val_conv.is_owned = ptr_is_owned(val);
62986         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62987         val_conv = NodeAlias_clone(&val_conv);
62988         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
62989 }
62990
62991 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
62992         LDKNodeAnnouncementInfo this_ptr_conv;
62993         this_ptr_conv.inner = untag_ptr(this_ptr);
62994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62996         this_ptr_conv.is_owned = false;
62997         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
62998         uint64_t ret_ref = 0;
62999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63001         return ret_ref;
63002 }
63003
63004 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
63005         LDKNodeAnnouncementInfo this_ptr_conv;
63006         this_ptr_conv.inner = untag_ptr(this_ptr);
63007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63009         this_ptr_conv.is_owned = false;
63010         LDKNodeAnnouncement val_conv;
63011         val_conv.inner = untag_ptr(val);
63012         val_conv.is_owned = ptr_is_owned(val);
63013         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63014         val_conv = NodeAnnouncement_clone(&val_conv);
63015         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
63016 }
63017
63018 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) {
63019         LDKNodeFeatures features_arg_conv;
63020         features_arg_conv.inner = untag_ptr(features_arg);
63021         features_arg_conv.is_owned = ptr_is_owned(features_arg);
63022         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
63023         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
63024         LDKThreeBytes rgb_arg_ref;
63025         CHECK(rgb_arg->arr_len == 3);
63026         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
63027         LDKNodeAlias alias_arg_conv;
63028         alias_arg_conv.inner = untag_ptr(alias_arg);
63029         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
63030         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
63031         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
63032         LDKNodeAnnouncement announcement_message_arg_conv;
63033         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
63034         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
63035         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
63036         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
63037         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
63038         uint64_t ret_ref = 0;
63039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63041         return ret_ref;
63042 }
63043
63044 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
63045         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
63046         uint64_t ret_ref = 0;
63047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63049         return ret_ref;
63050 }
63051 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
63052         LDKNodeAnnouncementInfo arg_conv;
63053         arg_conv.inner = untag_ptr(arg);
63054         arg_conv.is_owned = ptr_is_owned(arg);
63055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63056         arg_conv.is_owned = false;
63057         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
63058         return ret_conv;
63059 }
63060
63061 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
63062         LDKNodeAnnouncementInfo orig_conv;
63063         orig_conv.inner = untag_ptr(orig);
63064         orig_conv.is_owned = ptr_is_owned(orig);
63065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63066         orig_conv.is_owned = false;
63067         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
63068         uint64_t ret_ref = 0;
63069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63071         return ret_ref;
63072 }
63073
63074 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
63075         LDKNodeAnnouncementInfo a_conv;
63076         a_conv.inner = untag_ptr(a);
63077         a_conv.is_owned = ptr_is_owned(a);
63078         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63079         a_conv.is_owned = false;
63080         LDKNodeAnnouncementInfo b_conv;
63081         b_conv.inner = untag_ptr(b);
63082         b_conv.is_owned = ptr_is_owned(b);
63083         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63084         b_conv.is_owned = false;
63085         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
63086         return ret_conv;
63087 }
63088
63089 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
63090         LDKNodeAnnouncementInfo this_arg_conv;
63091         this_arg_conv.inner = untag_ptr(this_arg);
63092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63094         this_arg_conv.is_owned = false;
63095         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
63096         uint64_tArray ret_arr = NULL;
63097         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63098         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63099         for (size_t p = 0; p < ret_var.datalen; p++) {
63100                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
63101                 *ret_conv_15_copy = ret_var.data[p];
63102                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
63103                 ret_arr_ptr[p] = ret_conv_15_ref;
63104         }
63105         
63106         FREE(ret_var.data);
63107         return ret_arr;
63108 }
63109
63110 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
63111         LDKNodeAnnouncementInfo obj_conv;
63112         obj_conv.inner = untag_ptr(obj);
63113         obj_conv.is_owned = ptr_is_owned(obj);
63114         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63115         obj_conv.is_owned = false;
63116         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
63117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63119         CVec_u8Z_free(ret_var);
63120         return ret_arr;
63121 }
63122
63123 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
63124         LDKu8slice ser_ref;
63125         ser_ref.datalen = ser->arr_len;
63126         ser_ref.data = ser->elems;
63127         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
63128         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
63129         FREE(ser);
63130         return tag_ptr(ret_conv, true);
63131 }
63132
63133 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
63134         LDKNodeAlias this_obj_conv;
63135         this_obj_conv.inner = untag_ptr(this_obj);
63136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63138         NodeAlias_free(this_obj_conv);
63139 }
63140
63141 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
63142         LDKNodeAlias this_ptr_conv;
63143         this_ptr_conv.inner = untag_ptr(this_ptr);
63144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63146         this_ptr_conv.is_owned = false;
63147         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63148         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
63149         return ret_arr;
63150 }
63151
63152 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
63153         LDKNodeAlias this_ptr_conv;
63154         this_ptr_conv.inner = untag_ptr(this_ptr);
63155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63157         this_ptr_conv.is_owned = false;
63158         LDKThirtyTwoBytes val_ref;
63159         CHECK(val->arr_len == 32);
63160         memcpy(val_ref.data, val->elems, 32); FREE(val);
63161         NodeAlias_set_a(&this_ptr_conv, val_ref);
63162 }
63163
63164 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
63165         LDKThirtyTwoBytes a_arg_ref;
63166         CHECK(a_arg->arr_len == 32);
63167         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63168         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
63169         uint64_t ret_ref = 0;
63170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63172         return ret_ref;
63173 }
63174
63175 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
63176         LDKNodeAlias ret_var = NodeAlias_clone(arg);
63177         uint64_t ret_ref = 0;
63178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63180         return ret_ref;
63181 }
63182 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
63183         LDKNodeAlias arg_conv;
63184         arg_conv.inner = untag_ptr(arg);
63185         arg_conv.is_owned = ptr_is_owned(arg);
63186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63187         arg_conv.is_owned = false;
63188         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
63189         return ret_conv;
63190 }
63191
63192 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
63193         LDKNodeAlias orig_conv;
63194         orig_conv.inner = untag_ptr(orig);
63195         orig_conv.is_owned = ptr_is_owned(orig);
63196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63197         orig_conv.is_owned = false;
63198         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
63199         uint64_t ret_ref = 0;
63200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63202         return ret_ref;
63203 }
63204
63205 int64_t  __attribute__((export_name("TS_NodeAlias_hash"))) TS_NodeAlias_hash(uint64_t o) {
63206         LDKNodeAlias o_conv;
63207         o_conv.inner = untag_ptr(o);
63208         o_conv.is_owned = ptr_is_owned(o);
63209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63210         o_conv.is_owned = false;
63211         int64_t ret_conv = NodeAlias_hash(&o_conv);
63212         return ret_conv;
63213 }
63214
63215 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
63216         LDKNodeAlias a_conv;
63217         a_conv.inner = untag_ptr(a);
63218         a_conv.is_owned = ptr_is_owned(a);
63219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63220         a_conv.is_owned = false;
63221         LDKNodeAlias b_conv;
63222         b_conv.inner = untag_ptr(b);
63223         b_conv.is_owned = ptr_is_owned(b);
63224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63225         b_conv.is_owned = false;
63226         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
63227         return ret_conv;
63228 }
63229
63230 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
63231         LDKNodeAlias obj_conv;
63232         obj_conv.inner = untag_ptr(obj);
63233         obj_conv.is_owned = ptr_is_owned(obj);
63234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63235         obj_conv.is_owned = false;
63236         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
63237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63239         CVec_u8Z_free(ret_var);
63240         return ret_arr;
63241 }
63242
63243 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
63244         LDKu8slice ser_ref;
63245         ser_ref.datalen = ser->arr_len;
63246         ser_ref.data = ser->elems;
63247         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
63248         *ret_conv = NodeAlias_read(ser_ref);
63249         FREE(ser);
63250         return tag_ptr(ret_conv, true);
63251 }
63252
63253 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
63254         LDKNodeInfo this_obj_conv;
63255         this_obj_conv.inner = untag_ptr(this_obj);
63256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63258         NodeInfo_free(this_obj_conv);
63259 }
63260
63261 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
63262         LDKNodeInfo this_ptr_conv;
63263         this_ptr_conv.inner = untag_ptr(this_ptr);
63264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63266         this_ptr_conv.is_owned = false;
63267         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
63268         int64_tArray ret_arr = NULL;
63269         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63270         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63271         for (size_t i = 0; i < ret_var.datalen; i++) {
63272                 int64_t ret_conv_8_conv = ret_var.data[i];
63273                 ret_arr_ptr[i] = ret_conv_8_conv;
63274         }
63275         
63276         FREE(ret_var.data);
63277         return ret_arr;
63278 }
63279
63280 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
63281         LDKNodeInfo this_ptr_conv;
63282         this_ptr_conv.inner = untag_ptr(this_ptr);
63283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63285         this_ptr_conv.is_owned = false;
63286         LDKCVec_u64Z val_constr;
63287         val_constr.datalen = val->arr_len;
63288         if (val_constr.datalen > 0)
63289                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63290         else
63291                 val_constr.data = NULL;
63292         int64_t* val_vals = val->elems;
63293         for (size_t i = 0; i < val_constr.datalen; i++) {
63294                 int64_t val_conv_8 = val_vals[i];
63295                 val_constr.data[i] = val_conv_8;
63296         }
63297         FREE(val);
63298         NodeInfo_set_channels(&this_ptr_conv, val_constr);
63299 }
63300
63301 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
63302         LDKNodeInfo this_ptr_conv;
63303         this_ptr_conv.inner = untag_ptr(this_ptr);
63304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63306         this_ptr_conv.is_owned = false;
63307         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
63308         uint64_t ret_ref = 0;
63309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63311         return ret_ref;
63312 }
63313
63314 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
63315         LDKNodeInfo this_ptr_conv;
63316         this_ptr_conv.inner = untag_ptr(this_ptr);
63317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63319         this_ptr_conv.is_owned = false;
63320         LDKNodeAnnouncementInfo val_conv;
63321         val_conv.inner = untag_ptr(val);
63322         val_conv.is_owned = ptr_is_owned(val);
63323         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63324         val_conv = NodeAnnouncementInfo_clone(&val_conv);
63325         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
63326 }
63327
63328 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
63329         LDKCVec_u64Z channels_arg_constr;
63330         channels_arg_constr.datalen = channels_arg->arr_len;
63331         if (channels_arg_constr.datalen > 0)
63332                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63333         else
63334                 channels_arg_constr.data = NULL;
63335         int64_t* channels_arg_vals = channels_arg->elems;
63336         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
63337                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
63338                 channels_arg_constr.data[i] = channels_arg_conv_8;
63339         }
63340         FREE(channels_arg);
63341         LDKNodeAnnouncementInfo announcement_info_arg_conv;
63342         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
63343         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
63344         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
63345         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
63346         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
63347         uint64_t ret_ref = 0;
63348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63350         return ret_ref;
63351 }
63352
63353 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
63354         LDKNodeInfo ret_var = NodeInfo_clone(arg);
63355         uint64_t ret_ref = 0;
63356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63358         return ret_ref;
63359 }
63360 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
63361         LDKNodeInfo arg_conv;
63362         arg_conv.inner = untag_ptr(arg);
63363         arg_conv.is_owned = ptr_is_owned(arg);
63364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63365         arg_conv.is_owned = false;
63366         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
63367         return ret_conv;
63368 }
63369
63370 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
63371         LDKNodeInfo orig_conv;
63372         orig_conv.inner = untag_ptr(orig);
63373         orig_conv.is_owned = ptr_is_owned(orig);
63374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63375         orig_conv.is_owned = false;
63376         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
63377         uint64_t ret_ref = 0;
63378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63380         return ret_ref;
63381 }
63382
63383 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
63384         LDKNodeInfo a_conv;
63385         a_conv.inner = untag_ptr(a);
63386         a_conv.is_owned = ptr_is_owned(a);
63387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63388         a_conv.is_owned = false;
63389         LDKNodeInfo b_conv;
63390         b_conv.inner = untag_ptr(b);
63391         b_conv.is_owned = ptr_is_owned(b);
63392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63393         b_conv.is_owned = false;
63394         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
63395         return ret_conv;
63396 }
63397
63398 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
63399         LDKNodeInfo obj_conv;
63400         obj_conv.inner = untag_ptr(obj);
63401         obj_conv.is_owned = ptr_is_owned(obj);
63402         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63403         obj_conv.is_owned = false;
63404         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
63405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63407         CVec_u8Z_free(ret_var);
63408         return ret_arr;
63409 }
63410
63411 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
63412         LDKu8slice ser_ref;
63413         ser_ref.datalen = ser->arr_len;
63414         ser_ref.data = ser->elems;
63415         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
63416         *ret_conv = NodeInfo_read(ser_ref);
63417         FREE(ser);
63418         return tag_ptr(ret_conv, true);
63419 }
63420
63421 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
63422         LDKNetworkGraph obj_conv;
63423         obj_conv.inner = untag_ptr(obj);
63424         obj_conv.is_owned = ptr_is_owned(obj);
63425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63426         obj_conv.is_owned = false;
63427         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
63428         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63429         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63430         CVec_u8Z_free(ret_var);
63431         return ret_arr;
63432 }
63433
63434 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
63435         LDKu8slice ser_ref;
63436         ser_ref.datalen = ser->arr_len;
63437         ser_ref.data = ser->elems;
63438         void* arg_ptr = untag_ptr(arg);
63439         CHECK_ACCESS(arg_ptr);
63440         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
63441         if (arg_conv.free == LDKLogger_JCalls_free) {
63442                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63443                 LDKLogger_JCalls_cloned(&arg_conv);
63444         }
63445         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
63446         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
63447         FREE(ser);
63448         return tag_ptr(ret_conv, true);
63449 }
63450
63451 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
63452         LDKNetwork network_conv = LDKNetwork_from_js(network);
63453         void* logger_ptr = untag_ptr(logger);
63454         CHECK_ACCESS(logger_ptr);
63455         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63456         if (logger_conv.free == LDKLogger_JCalls_free) {
63457                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63458                 LDKLogger_JCalls_cloned(&logger_conv);
63459         }
63460         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
63461         uint64_t ret_ref = 0;
63462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63464         return ret_ref;
63465 }
63466
63467 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
63468         LDKNetworkGraph this_arg_conv;
63469         this_arg_conv.inner = untag_ptr(this_arg);
63470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63472         this_arg_conv.is_owned = false;
63473         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
63474         uint64_t ret_ref = 0;
63475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63477         return ret_ref;
63478 }
63479
63480 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) {
63481         LDKNetworkGraph this_arg_conv;
63482         this_arg_conv.inner = untag_ptr(this_arg);
63483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63485         this_arg_conv.is_owned = false;
63486         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63487         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
63488         uint64_t ret_ref = tag_ptr(ret_copy, true);
63489         return ret_ref;
63490 }
63491
63492 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) {
63493         LDKNetworkGraph this_arg_conv;
63494         this_arg_conv.inner = untag_ptr(this_arg);
63495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63497         this_arg_conv.is_owned = false;
63498         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
63499 }
63500
63501 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
63502         LDKNetworkGraph this_arg_conv;
63503         this_arg_conv.inner = untag_ptr(this_arg);
63504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63506         this_arg_conv.is_owned = false;
63507         LDKNodeAnnouncement msg_conv;
63508         msg_conv.inner = untag_ptr(msg);
63509         msg_conv.is_owned = ptr_is_owned(msg);
63510         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63511         msg_conv.is_owned = false;
63512         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63513         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
63514         return tag_ptr(ret_conv, true);
63515 }
63516
63517 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) {
63518         LDKNetworkGraph this_arg_conv;
63519         this_arg_conv.inner = untag_ptr(this_arg);
63520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63522         this_arg_conv.is_owned = false;
63523         LDKUnsignedNodeAnnouncement msg_conv;
63524         msg_conv.inner = untag_ptr(msg);
63525         msg_conv.is_owned = ptr_is_owned(msg);
63526         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63527         msg_conv.is_owned = false;
63528         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63529         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
63530         return tag_ptr(ret_conv, true);
63531 }
63532
63533 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) {
63534         LDKNetworkGraph this_arg_conv;
63535         this_arg_conv.inner = untag_ptr(this_arg);
63536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63538         this_arg_conv.is_owned = false;
63539         LDKChannelAnnouncement msg_conv;
63540         msg_conv.inner = untag_ptr(msg);
63541         msg_conv.is_owned = ptr_is_owned(msg);
63542         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63543         msg_conv.is_owned = false;
63544         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63545         CHECK_ACCESS(utxo_lookup_ptr);
63546         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63547         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63548         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63549                 // Manually implement clone for Java trait instances
63550                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63551                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63552                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63553                 }
63554         }
63555         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63556         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63557         return tag_ptr(ret_conv, true);
63558 }
63559
63560 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) {
63561         LDKNetworkGraph this_arg_conv;
63562         this_arg_conv.inner = untag_ptr(this_arg);
63563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63565         this_arg_conv.is_owned = false;
63566         LDKChannelAnnouncement msg_conv;
63567         msg_conv.inner = untag_ptr(msg);
63568         msg_conv.is_owned = ptr_is_owned(msg);
63569         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63570         msg_conv.is_owned = false;
63571         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63572         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
63573         return tag_ptr(ret_conv, true);
63574 }
63575
63576 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) {
63577         LDKNetworkGraph this_arg_conv;
63578         this_arg_conv.inner = untag_ptr(this_arg);
63579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63581         this_arg_conv.is_owned = false;
63582         LDKUnsignedChannelAnnouncement msg_conv;
63583         msg_conv.inner = untag_ptr(msg);
63584         msg_conv.is_owned = ptr_is_owned(msg);
63585         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63586         msg_conv.is_owned = false;
63587         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63588         CHECK_ACCESS(utxo_lookup_ptr);
63589         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63590         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63591         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63592                 // Manually implement clone for Java trait instances
63593                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63594                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63595                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63596                 }
63597         }
63598         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63599         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63600         return tag_ptr(ret_conv, true);
63601 }
63602
63603 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) {
63604         LDKNetworkGraph this_arg_conv;
63605         this_arg_conv.inner = untag_ptr(this_arg);
63606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63608         this_arg_conv.is_owned = false;
63609         LDKChannelFeatures features_conv;
63610         features_conv.inner = untag_ptr(features);
63611         features_conv.is_owned = ptr_is_owned(features);
63612         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63613         features_conv = ChannelFeatures_clone(&features_conv);
63614         LDKPublicKey node_id_1_ref;
63615         CHECK(node_id_1->arr_len == 33);
63616         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
63617         LDKPublicKey node_id_2_ref;
63618         CHECK(node_id_2->arr_len == 33);
63619         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
63620         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63621         *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);
63622         return tag_ptr(ret_conv, true);
63623 }
63624
63625 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
63626         LDKNetworkGraph this_arg_conv;
63627         this_arg_conv.inner = untag_ptr(this_arg);
63628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63630         this_arg_conv.is_owned = false;
63631         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
63632 }
63633
63634 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
63635         LDKNetworkGraph this_arg_conv;
63636         this_arg_conv.inner = untag_ptr(this_arg);
63637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63639         this_arg_conv.is_owned = false;
63640         LDKPublicKey node_id_ref;
63641         CHECK(node_id->arr_len == 33);
63642         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
63643         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
63644 }
63645
63646 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) {
63647         LDKNetworkGraph this_arg_conv;
63648         this_arg_conv.inner = untag_ptr(this_arg);
63649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63651         this_arg_conv.is_owned = false;
63652         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
63653 }
63654
63655 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
63656         LDKNetworkGraph this_arg_conv;
63657         this_arg_conv.inner = untag_ptr(this_arg);
63658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63660         this_arg_conv.is_owned = false;
63661         LDKChannelUpdate msg_conv;
63662         msg_conv.inner = untag_ptr(msg);
63663         msg_conv.is_owned = ptr_is_owned(msg);
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63665         msg_conv.is_owned = false;
63666         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63667         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
63668         return tag_ptr(ret_conv, true);
63669 }
63670
63671 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
63672         LDKNetworkGraph this_arg_conv;
63673         this_arg_conv.inner = untag_ptr(this_arg);
63674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63676         this_arg_conv.is_owned = false;
63677         LDKUnsignedChannelUpdate msg_conv;
63678         msg_conv.inner = untag_ptr(msg);
63679         msg_conv.is_owned = ptr_is_owned(msg);
63680         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63681         msg_conv.is_owned = false;
63682         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63683         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
63684         return tag_ptr(ret_conv, true);
63685 }
63686
63687 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
63688         LDKNetworkGraph this_arg_conv;
63689         this_arg_conv.inner = untag_ptr(this_arg);
63690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63692         this_arg_conv.is_owned = false;
63693         LDKChannelUpdate msg_conv;
63694         msg_conv.inner = untag_ptr(msg);
63695         msg_conv.is_owned = ptr_is_owned(msg);
63696         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63697         msg_conv.is_owned = false;
63698         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63699         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
63700         return tag_ptr(ret_conv, true);
63701 }
63702
63703 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
63704         LDKReadOnlyNetworkGraph this_arg_conv;
63705         this_arg_conv.inner = untag_ptr(this_arg);
63706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63708         this_arg_conv.is_owned = false;
63709         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
63710         uint64_t ret_ref = 0;
63711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63713         return ret_ref;
63714 }
63715
63716 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
63717         LDKReadOnlyNetworkGraph this_arg_conv;
63718         this_arg_conv.inner = untag_ptr(this_arg);
63719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63721         this_arg_conv.is_owned = false;
63722         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
63723         int64_tArray ret_arr = NULL;
63724         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63725         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63726         for (size_t i = 0; i < ret_var.datalen; i++) {
63727                 int64_t ret_conv_8_conv = ret_var.data[i];
63728                 ret_arr_ptr[i] = ret_conv_8_conv;
63729         }
63730         
63731         FREE(ret_var.data);
63732         return ret_arr;
63733 }
63734
63735 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
63736         LDKReadOnlyNetworkGraph this_arg_conv;
63737         this_arg_conv.inner = untag_ptr(this_arg);
63738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63740         this_arg_conv.is_owned = false;
63741         LDKNodeId node_id_conv;
63742         node_id_conv.inner = untag_ptr(node_id);
63743         node_id_conv.is_owned = ptr_is_owned(node_id);
63744         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
63745         node_id_conv.is_owned = false;
63746         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
63747         uint64_t ret_ref = 0;
63748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63750         return ret_ref;
63751 }
63752
63753 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
63754         LDKReadOnlyNetworkGraph this_arg_conv;
63755         this_arg_conv.inner = untag_ptr(this_arg);
63756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63758         this_arg_conv.is_owned = false;
63759         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
63760         uint64_tArray ret_arr = NULL;
63761         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63762         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63763         for (size_t i = 0; i < ret_var.datalen; i++) {
63764                 LDKNodeId ret_conv_8_var = ret_var.data[i];
63765                 uint64_t ret_conv_8_ref = 0;
63766                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
63767                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
63768                 ret_arr_ptr[i] = ret_conv_8_ref;
63769         }
63770         
63771         FREE(ret_var.data);
63772         return ret_arr;
63773 }
63774
63775 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
63776         LDKReadOnlyNetworkGraph this_arg_conv;
63777         this_arg_conv.inner = untag_ptr(this_arg);
63778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63780         this_arg_conv.is_owned = false;
63781         LDKPublicKey pubkey_ref;
63782         CHECK(pubkey->arr_len == 33);
63783         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
63784         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
63785         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
63786         uint64_t ret_ref = tag_ptr(ret_copy, true);
63787         return ret_ref;
63788 }
63789
63790 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
63791         LDKDefaultRouter this_obj_conv;
63792         this_obj_conv.inner = untag_ptr(this_obj);
63793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63795         DefaultRouter_free(this_obj_conv);
63796 }
63797
63798 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, uint64_t entropy_source, uint64_t scorer, uint64_t score_params) {
63799         LDKNetworkGraph network_graph_conv;
63800         network_graph_conv.inner = untag_ptr(network_graph);
63801         network_graph_conv.is_owned = ptr_is_owned(network_graph);
63802         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
63803         network_graph_conv.is_owned = false;
63804         void* logger_ptr = untag_ptr(logger);
63805         CHECK_ACCESS(logger_ptr);
63806         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63807         if (logger_conv.free == LDKLogger_JCalls_free) {
63808                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63809                 LDKLogger_JCalls_cloned(&logger_conv);
63810         }
63811         void* entropy_source_ptr = untag_ptr(entropy_source);
63812         CHECK_ACCESS(entropy_source_ptr);
63813         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63814         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63816                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63817         }
63818         void* scorer_ptr = untag_ptr(scorer);
63819         CHECK_ACCESS(scorer_ptr);
63820         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
63821         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
63822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63823                 LDKLockableScore_JCalls_cloned(&scorer_conv);
63824         }
63825         LDKProbabilisticScoringFeeParameters score_params_conv;
63826         score_params_conv.inner = untag_ptr(score_params);
63827         score_params_conv.is_owned = ptr_is_owned(score_params);
63828         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
63829         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
63830         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
63831         uint64_t ret_ref = 0;
63832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63834         return ret_ref;
63835 }
63836
63837 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
63838         LDKDefaultRouter this_arg_conv;
63839         this_arg_conv.inner = untag_ptr(this_arg);
63840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63842         this_arg_conv.is_owned = false;
63843         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
63844         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
63845         return tag_ptr(ret_ret, true);
63846 }
63847
63848 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_MessageRouter"))) TS_DefaultRouter_as_MessageRouter(uint64_t this_arg) {
63849         LDKDefaultRouter this_arg_conv;
63850         this_arg_conv.inner = untag_ptr(this_arg);
63851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63853         this_arg_conv.is_owned = false;
63854         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
63855         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
63856         return tag_ptr(ret_ret, true);
63857 }
63858
63859 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
63860         if (!ptr_is_owned(this_ptr)) return;
63861         void* this_ptr_ptr = untag_ptr(this_ptr);
63862         CHECK_ACCESS(this_ptr_ptr);
63863         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
63864         FREE(untag_ptr(this_ptr));
63865         Router_free(this_ptr_conv);
63866 }
63867
63868 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
63869         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
63870         this_obj_conv.inner = untag_ptr(this_obj);
63871         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63873         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
63874 }
63875
63876 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
63877         void* scorer_ptr = untag_ptr(scorer);
63878         CHECK_ACCESS(scorer_ptr);
63879         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
63880         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
63881                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63882                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
63883         }
63884         LDKInFlightHtlcs inflight_htlcs_conv;
63885         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
63886         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
63887         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
63888         inflight_htlcs_conv.is_owned = false;
63889         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
63890         uint64_t ret_ref = 0;
63891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63893         return ret_ref;
63894 }
63895
63896 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
63897         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
63898         this_arg_conv.inner = untag_ptr(this_arg);
63899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63901         this_arg_conv.is_owned = false;
63902         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
63903         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
63904         return tag_ptr(ret_ret, true);
63905 }
63906
63907 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
63908         LDKInFlightHtlcs this_obj_conv;
63909         this_obj_conv.inner = untag_ptr(this_obj);
63910         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63912         InFlightHtlcs_free(this_obj_conv);
63913 }
63914
63915 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
63916         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
63917         uint64_t ret_ref = 0;
63918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63920         return ret_ref;
63921 }
63922 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
63923         LDKInFlightHtlcs arg_conv;
63924         arg_conv.inner = untag_ptr(arg);
63925         arg_conv.is_owned = ptr_is_owned(arg);
63926         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63927         arg_conv.is_owned = false;
63928         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
63929         return ret_conv;
63930 }
63931
63932 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
63933         LDKInFlightHtlcs orig_conv;
63934         orig_conv.inner = untag_ptr(orig);
63935         orig_conv.is_owned = ptr_is_owned(orig);
63936         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63937         orig_conv.is_owned = false;
63938         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
63939         uint64_t ret_ref = 0;
63940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63942         return ret_ref;
63943 }
63944
63945 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
63946         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
63947         uint64_t ret_ref = 0;
63948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63950         return ret_ref;
63951 }
63952
63953 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
63954         LDKInFlightHtlcs this_arg_conv;
63955         this_arg_conv.inner = untag_ptr(this_arg);
63956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63958         this_arg_conv.is_owned = false;
63959         LDKPath path_conv;
63960         path_conv.inner = untag_ptr(path);
63961         path_conv.is_owned = ptr_is_owned(path);
63962         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63963         path_conv.is_owned = false;
63964         LDKPublicKey payer_node_id_ref;
63965         CHECK(payer_node_id->arr_len == 33);
63966         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
63967         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
63968 }
63969
63970 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) {
63971         LDKInFlightHtlcs this_arg_conv;
63972         this_arg_conv.inner = untag_ptr(this_arg);
63973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63975         this_arg_conv.is_owned = false;
63976         LDKNodeId source_conv;
63977         source_conv.inner = untag_ptr(source);
63978         source_conv.is_owned = ptr_is_owned(source);
63979         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63980         source_conv.is_owned = false;
63981         LDKNodeId target_conv;
63982         target_conv.inner = untag_ptr(target);
63983         target_conv.is_owned = ptr_is_owned(target);
63984         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63985         target_conv.is_owned = false;
63986         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
63987 }
63988
63989 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) {
63990         LDKInFlightHtlcs this_arg_conv;
63991         this_arg_conv.inner = untag_ptr(this_arg);
63992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63994         this_arg_conv.is_owned = false;
63995         LDKNodeId source_conv;
63996         source_conv.inner = untag_ptr(source);
63997         source_conv.is_owned = ptr_is_owned(source);
63998         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63999         source_conv.is_owned = false;
64000         LDKNodeId target_conv;
64001         target_conv.inner = untag_ptr(target);
64002         target_conv.is_owned = ptr_is_owned(target);
64003         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
64004         target_conv.is_owned = false;
64005         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64006         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
64007         uint64_t ret_ref = tag_ptr(ret_copy, true);
64008         return ret_ref;
64009 }
64010
64011 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
64012         LDKInFlightHtlcs obj_conv;
64013         obj_conv.inner = untag_ptr(obj);
64014         obj_conv.is_owned = ptr_is_owned(obj);
64015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64016         obj_conv.is_owned = false;
64017         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
64018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64020         CVec_u8Z_free(ret_var);
64021         return ret_arr;
64022 }
64023
64024 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
64025         LDKu8slice ser_ref;
64026         ser_ref.datalen = ser->arr_len;
64027         ser_ref.data = ser->elems;
64028         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
64029         *ret_conv = InFlightHtlcs_read(ser_ref);
64030         FREE(ser);
64031         return tag_ptr(ret_conv, true);
64032 }
64033
64034 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
64035         LDKRouteHop this_obj_conv;
64036         this_obj_conv.inner = untag_ptr(this_obj);
64037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64039         RouteHop_free(this_obj_conv);
64040 }
64041
64042 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
64043         LDKRouteHop this_ptr_conv;
64044         this_ptr_conv.inner = untag_ptr(this_ptr);
64045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64047         this_ptr_conv.is_owned = false;
64048         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64049         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
64050         return ret_arr;
64051 }
64052
64053 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
64054         LDKRouteHop this_ptr_conv;
64055         this_ptr_conv.inner = untag_ptr(this_ptr);
64056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64058         this_ptr_conv.is_owned = false;
64059         LDKPublicKey val_ref;
64060         CHECK(val->arr_len == 33);
64061         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64062         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
64063 }
64064
64065 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
64066         LDKRouteHop this_ptr_conv;
64067         this_ptr_conv.inner = untag_ptr(this_ptr);
64068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64070         this_ptr_conv.is_owned = false;
64071         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
64072         uint64_t ret_ref = 0;
64073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64075         return ret_ref;
64076 }
64077
64078 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
64079         LDKRouteHop this_ptr_conv;
64080         this_ptr_conv.inner = untag_ptr(this_ptr);
64081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64083         this_ptr_conv.is_owned = false;
64084         LDKNodeFeatures val_conv;
64085         val_conv.inner = untag_ptr(val);
64086         val_conv.is_owned = ptr_is_owned(val);
64087         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64088         val_conv = NodeFeatures_clone(&val_conv);
64089         RouteHop_set_node_features(&this_ptr_conv, val_conv);
64090 }
64091
64092 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
64093         LDKRouteHop this_ptr_conv;
64094         this_ptr_conv.inner = untag_ptr(this_ptr);
64095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64097         this_ptr_conv.is_owned = false;
64098         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
64099         return ret_conv;
64100 }
64101
64102 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
64103         LDKRouteHop this_ptr_conv;
64104         this_ptr_conv.inner = untag_ptr(this_ptr);
64105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64107         this_ptr_conv.is_owned = false;
64108         RouteHop_set_short_channel_id(&this_ptr_conv, val);
64109 }
64110
64111 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
64112         LDKRouteHop this_ptr_conv;
64113         this_ptr_conv.inner = untag_ptr(this_ptr);
64114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64116         this_ptr_conv.is_owned = false;
64117         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
64118         uint64_t ret_ref = 0;
64119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64121         return ret_ref;
64122 }
64123
64124 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
64125         LDKRouteHop this_ptr_conv;
64126         this_ptr_conv.inner = untag_ptr(this_ptr);
64127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64129         this_ptr_conv.is_owned = false;
64130         LDKChannelFeatures val_conv;
64131         val_conv.inner = untag_ptr(val);
64132         val_conv.is_owned = ptr_is_owned(val);
64133         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64134         val_conv = ChannelFeatures_clone(&val_conv);
64135         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
64136 }
64137
64138 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
64139         LDKRouteHop this_ptr_conv;
64140         this_ptr_conv.inner = untag_ptr(this_ptr);
64141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64143         this_ptr_conv.is_owned = false;
64144         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
64145         return ret_conv;
64146 }
64147
64148 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
64149         LDKRouteHop this_ptr_conv;
64150         this_ptr_conv.inner = untag_ptr(this_ptr);
64151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64153         this_ptr_conv.is_owned = false;
64154         RouteHop_set_fee_msat(&this_ptr_conv, val);
64155 }
64156
64157 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
64158         LDKRouteHop this_ptr_conv;
64159         this_ptr_conv.inner = untag_ptr(this_ptr);
64160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64162         this_ptr_conv.is_owned = false;
64163         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
64164         return ret_conv;
64165 }
64166
64167 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
64168         LDKRouteHop this_ptr_conv;
64169         this_ptr_conv.inner = untag_ptr(this_ptr);
64170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64172         this_ptr_conv.is_owned = false;
64173         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
64174 }
64175
64176 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
64177         LDKRouteHop this_ptr_conv;
64178         this_ptr_conv.inner = untag_ptr(this_ptr);
64179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64181         this_ptr_conv.is_owned = false;
64182         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
64183         return ret_conv;
64184 }
64185
64186 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
64187         LDKRouteHop this_ptr_conv;
64188         this_ptr_conv.inner = untag_ptr(this_ptr);
64189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64191         this_ptr_conv.is_owned = false;
64192         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
64193 }
64194
64195 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) {
64196         LDKPublicKey pubkey_arg_ref;
64197         CHECK(pubkey_arg->arr_len == 33);
64198         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
64199         LDKNodeFeatures node_features_arg_conv;
64200         node_features_arg_conv.inner = untag_ptr(node_features_arg);
64201         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
64202         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
64203         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
64204         LDKChannelFeatures channel_features_arg_conv;
64205         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
64206         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
64207         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
64208         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
64209         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);
64210         uint64_t ret_ref = 0;
64211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64213         return ret_ref;
64214 }
64215
64216 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
64217         LDKRouteHop ret_var = RouteHop_clone(arg);
64218         uint64_t ret_ref = 0;
64219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64221         return ret_ref;
64222 }
64223 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
64224         LDKRouteHop arg_conv;
64225         arg_conv.inner = untag_ptr(arg);
64226         arg_conv.is_owned = ptr_is_owned(arg);
64227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64228         arg_conv.is_owned = false;
64229         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
64230         return ret_conv;
64231 }
64232
64233 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
64234         LDKRouteHop orig_conv;
64235         orig_conv.inner = untag_ptr(orig);
64236         orig_conv.is_owned = ptr_is_owned(orig);
64237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64238         orig_conv.is_owned = false;
64239         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
64240         uint64_t ret_ref = 0;
64241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64243         return ret_ref;
64244 }
64245
64246 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
64247         LDKRouteHop o_conv;
64248         o_conv.inner = untag_ptr(o);
64249         o_conv.is_owned = ptr_is_owned(o);
64250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64251         o_conv.is_owned = false;
64252         int64_t ret_conv = RouteHop_hash(&o_conv);
64253         return ret_conv;
64254 }
64255
64256 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
64257         LDKRouteHop a_conv;
64258         a_conv.inner = untag_ptr(a);
64259         a_conv.is_owned = ptr_is_owned(a);
64260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64261         a_conv.is_owned = false;
64262         LDKRouteHop b_conv;
64263         b_conv.inner = untag_ptr(b);
64264         b_conv.is_owned = ptr_is_owned(b);
64265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64266         b_conv.is_owned = false;
64267         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
64268         return ret_conv;
64269 }
64270
64271 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
64272         LDKRouteHop obj_conv;
64273         obj_conv.inner = untag_ptr(obj);
64274         obj_conv.is_owned = ptr_is_owned(obj);
64275         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64276         obj_conv.is_owned = false;
64277         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
64278         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64279         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64280         CVec_u8Z_free(ret_var);
64281         return ret_arr;
64282 }
64283
64284 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
64285         LDKu8slice ser_ref;
64286         ser_ref.datalen = ser->arr_len;
64287         ser_ref.data = ser->elems;
64288         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
64289         *ret_conv = RouteHop_read(ser_ref);
64290         FREE(ser);
64291         return tag_ptr(ret_conv, true);
64292 }
64293
64294 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
64295         LDKBlindedTail this_obj_conv;
64296         this_obj_conv.inner = untag_ptr(this_obj);
64297         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64299         BlindedTail_free(this_obj_conv);
64300 }
64301
64302 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
64303         LDKBlindedTail this_ptr_conv;
64304         this_ptr_conv.inner = untag_ptr(this_ptr);
64305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64307         this_ptr_conv.is_owned = false;
64308         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
64309         uint64_tArray ret_arr = NULL;
64310         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64311         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64312         for (size_t m = 0; m < ret_var.datalen; m++) {
64313                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64314                 uint64_t ret_conv_12_ref = 0;
64315                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64316                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64317                 ret_arr_ptr[m] = ret_conv_12_ref;
64318         }
64319         
64320         FREE(ret_var.data);
64321         return ret_arr;
64322 }
64323
64324 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
64325         LDKBlindedTail this_ptr_conv;
64326         this_ptr_conv.inner = untag_ptr(this_ptr);
64327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64329         this_ptr_conv.is_owned = false;
64330         LDKCVec_BlindedHopZ val_constr;
64331         val_constr.datalen = val->arr_len;
64332         if (val_constr.datalen > 0)
64333                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64334         else
64335                 val_constr.data = NULL;
64336         uint64_t* val_vals = val->elems;
64337         for (size_t m = 0; m < val_constr.datalen; m++) {
64338                 uint64_t val_conv_12 = val_vals[m];
64339                 LDKBlindedHop val_conv_12_conv;
64340                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64341                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64342                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64343                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64344                 val_constr.data[m] = val_conv_12_conv;
64345         }
64346         FREE(val);
64347         BlindedTail_set_hops(&this_ptr_conv, val_constr);
64348 }
64349
64350 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
64351         LDKBlindedTail this_ptr_conv;
64352         this_ptr_conv.inner = untag_ptr(this_ptr);
64353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64355         this_ptr_conv.is_owned = false;
64356         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64357         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
64358         return ret_arr;
64359 }
64360
64361 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
64362         LDKBlindedTail this_ptr_conv;
64363         this_ptr_conv.inner = untag_ptr(this_ptr);
64364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64366         this_ptr_conv.is_owned = false;
64367         LDKPublicKey val_ref;
64368         CHECK(val->arr_len == 33);
64369         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64370         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
64371 }
64372
64373 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) {
64374         LDKBlindedTail this_ptr_conv;
64375         this_ptr_conv.inner = untag_ptr(this_ptr);
64376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64378         this_ptr_conv.is_owned = false;
64379         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
64380         return ret_conv;
64381 }
64382
64383 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) {
64384         LDKBlindedTail this_ptr_conv;
64385         this_ptr_conv.inner = untag_ptr(this_ptr);
64386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64388         this_ptr_conv.is_owned = false;
64389         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
64390 }
64391
64392 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
64393         LDKBlindedTail this_ptr_conv;
64394         this_ptr_conv.inner = untag_ptr(this_ptr);
64395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64397         this_ptr_conv.is_owned = false;
64398         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
64399         return ret_conv;
64400 }
64401
64402 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
64403         LDKBlindedTail this_ptr_conv;
64404         this_ptr_conv.inner = untag_ptr(this_ptr);
64405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64407         this_ptr_conv.is_owned = false;
64408         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
64409 }
64410
64411 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) {
64412         LDKCVec_BlindedHopZ hops_arg_constr;
64413         hops_arg_constr.datalen = hops_arg->arr_len;
64414         if (hops_arg_constr.datalen > 0)
64415                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64416         else
64417                 hops_arg_constr.data = NULL;
64418         uint64_t* hops_arg_vals = hops_arg->elems;
64419         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
64420                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
64421                 LDKBlindedHop hops_arg_conv_12_conv;
64422                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
64423                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
64424                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
64425                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
64426                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
64427         }
64428         FREE(hops_arg);
64429         LDKPublicKey blinding_point_arg_ref;
64430         CHECK(blinding_point_arg->arr_len == 33);
64431         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
64432         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
64433         uint64_t ret_ref = 0;
64434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64436         return ret_ref;
64437 }
64438
64439 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
64440         LDKBlindedTail ret_var = BlindedTail_clone(arg);
64441         uint64_t ret_ref = 0;
64442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64444         return ret_ref;
64445 }
64446 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
64447         LDKBlindedTail arg_conv;
64448         arg_conv.inner = untag_ptr(arg);
64449         arg_conv.is_owned = ptr_is_owned(arg);
64450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64451         arg_conv.is_owned = false;
64452         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
64453         return ret_conv;
64454 }
64455
64456 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
64457         LDKBlindedTail orig_conv;
64458         orig_conv.inner = untag_ptr(orig);
64459         orig_conv.is_owned = ptr_is_owned(orig);
64460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64461         orig_conv.is_owned = false;
64462         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
64463         uint64_t ret_ref = 0;
64464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64466         return ret_ref;
64467 }
64468
64469 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
64470         LDKBlindedTail o_conv;
64471         o_conv.inner = untag_ptr(o);
64472         o_conv.is_owned = ptr_is_owned(o);
64473         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64474         o_conv.is_owned = false;
64475         int64_t ret_conv = BlindedTail_hash(&o_conv);
64476         return ret_conv;
64477 }
64478
64479 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
64480         LDKBlindedTail a_conv;
64481         a_conv.inner = untag_ptr(a);
64482         a_conv.is_owned = ptr_is_owned(a);
64483         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64484         a_conv.is_owned = false;
64485         LDKBlindedTail b_conv;
64486         b_conv.inner = untag_ptr(b);
64487         b_conv.is_owned = ptr_is_owned(b);
64488         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64489         b_conv.is_owned = false;
64490         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
64491         return ret_conv;
64492 }
64493
64494 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
64495         LDKBlindedTail obj_conv;
64496         obj_conv.inner = untag_ptr(obj);
64497         obj_conv.is_owned = ptr_is_owned(obj);
64498         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64499         obj_conv.is_owned = false;
64500         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
64501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64503         CVec_u8Z_free(ret_var);
64504         return ret_arr;
64505 }
64506
64507 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
64508         LDKu8slice ser_ref;
64509         ser_ref.datalen = ser->arr_len;
64510         ser_ref.data = ser->elems;
64511         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
64512         *ret_conv = BlindedTail_read(ser_ref);
64513         FREE(ser);
64514         return tag_ptr(ret_conv, true);
64515 }
64516
64517 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
64518         LDKPath this_obj_conv;
64519         this_obj_conv.inner = untag_ptr(this_obj);
64520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64522         Path_free(this_obj_conv);
64523 }
64524
64525 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
64526         LDKPath this_ptr_conv;
64527         this_ptr_conv.inner = untag_ptr(this_ptr);
64528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64530         this_ptr_conv.is_owned = false;
64531         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
64532         uint64_tArray ret_arr = NULL;
64533         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64534         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64535         for (size_t k = 0; k < ret_var.datalen; k++) {
64536                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
64537                 uint64_t ret_conv_10_ref = 0;
64538                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
64539                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
64540                 ret_arr_ptr[k] = ret_conv_10_ref;
64541         }
64542         
64543         FREE(ret_var.data);
64544         return ret_arr;
64545 }
64546
64547 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
64548         LDKPath this_ptr_conv;
64549         this_ptr_conv.inner = untag_ptr(this_ptr);
64550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64552         this_ptr_conv.is_owned = false;
64553         LDKCVec_RouteHopZ val_constr;
64554         val_constr.datalen = val->arr_len;
64555         if (val_constr.datalen > 0)
64556                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64557         else
64558                 val_constr.data = NULL;
64559         uint64_t* val_vals = val->elems;
64560         for (size_t k = 0; k < val_constr.datalen; k++) {
64561                 uint64_t val_conv_10 = val_vals[k];
64562                 LDKRouteHop val_conv_10_conv;
64563                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
64564                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
64565                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
64566                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
64567                 val_constr.data[k] = val_conv_10_conv;
64568         }
64569         FREE(val);
64570         Path_set_hops(&this_ptr_conv, val_constr);
64571 }
64572
64573 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
64574         LDKPath this_ptr_conv;
64575         this_ptr_conv.inner = untag_ptr(this_ptr);
64576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64578         this_ptr_conv.is_owned = false;
64579         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
64580         uint64_t ret_ref = 0;
64581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64583         return ret_ref;
64584 }
64585
64586 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
64587         LDKPath this_ptr_conv;
64588         this_ptr_conv.inner = untag_ptr(this_ptr);
64589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64591         this_ptr_conv.is_owned = false;
64592         LDKBlindedTail val_conv;
64593         val_conv.inner = untag_ptr(val);
64594         val_conv.is_owned = ptr_is_owned(val);
64595         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64596         val_conv = BlindedTail_clone(&val_conv);
64597         Path_set_blinded_tail(&this_ptr_conv, val_conv);
64598 }
64599
64600 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
64601         LDKCVec_RouteHopZ hops_arg_constr;
64602         hops_arg_constr.datalen = hops_arg->arr_len;
64603         if (hops_arg_constr.datalen > 0)
64604                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64605         else
64606                 hops_arg_constr.data = NULL;
64607         uint64_t* hops_arg_vals = hops_arg->elems;
64608         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
64609                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
64610                 LDKRouteHop hops_arg_conv_10_conv;
64611                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
64612                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
64613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
64614                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
64615                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
64616         }
64617         FREE(hops_arg);
64618         LDKBlindedTail blinded_tail_arg_conv;
64619         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
64620         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
64621         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
64622         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
64623         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
64624         uint64_t ret_ref = 0;
64625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64627         return ret_ref;
64628 }
64629
64630 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
64631         LDKPath ret_var = Path_clone(arg);
64632         uint64_t ret_ref = 0;
64633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64635         return ret_ref;
64636 }
64637 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
64638         LDKPath arg_conv;
64639         arg_conv.inner = untag_ptr(arg);
64640         arg_conv.is_owned = ptr_is_owned(arg);
64641         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64642         arg_conv.is_owned = false;
64643         int64_t ret_conv = Path_clone_ptr(&arg_conv);
64644         return ret_conv;
64645 }
64646
64647 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
64648         LDKPath orig_conv;
64649         orig_conv.inner = untag_ptr(orig);
64650         orig_conv.is_owned = ptr_is_owned(orig);
64651         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64652         orig_conv.is_owned = false;
64653         LDKPath ret_var = Path_clone(&orig_conv);
64654         uint64_t ret_ref = 0;
64655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64657         return ret_ref;
64658 }
64659
64660 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
64661         LDKPath o_conv;
64662         o_conv.inner = untag_ptr(o);
64663         o_conv.is_owned = ptr_is_owned(o);
64664         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64665         o_conv.is_owned = false;
64666         int64_t ret_conv = Path_hash(&o_conv);
64667         return ret_conv;
64668 }
64669
64670 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
64671         LDKPath a_conv;
64672         a_conv.inner = untag_ptr(a);
64673         a_conv.is_owned = ptr_is_owned(a);
64674         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64675         a_conv.is_owned = false;
64676         LDKPath b_conv;
64677         b_conv.inner = untag_ptr(b);
64678         b_conv.is_owned = ptr_is_owned(b);
64679         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64680         b_conv.is_owned = false;
64681         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
64682         return ret_conv;
64683 }
64684
64685 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
64686         LDKPath this_arg_conv;
64687         this_arg_conv.inner = untag_ptr(this_arg);
64688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64690         this_arg_conv.is_owned = false;
64691         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
64692         return ret_conv;
64693 }
64694
64695 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
64696         LDKPath this_arg_conv;
64697         this_arg_conv.inner = untag_ptr(this_arg);
64698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64700         this_arg_conv.is_owned = false;
64701         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
64702         return ret_conv;
64703 }
64704
64705 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
64706         LDKPath this_arg_conv;
64707         this_arg_conv.inner = untag_ptr(this_arg);
64708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64710         this_arg_conv.is_owned = false;
64711         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
64712         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
64713         uint64_t ret_ref = tag_ptr(ret_copy, true);
64714         return ret_ref;
64715 }
64716
64717 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
64718         LDKRoute this_obj_conv;
64719         this_obj_conv.inner = untag_ptr(this_obj);
64720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64722         Route_free(this_obj_conv);
64723 }
64724
64725 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
64726         LDKRoute this_ptr_conv;
64727         this_ptr_conv.inner = untag_ptr(this_ptr);
64728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64730         this_ptr_conv.is_owned = false;
64731         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
64732         uint64_tArray ret_arr = NULL;
64733         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64734         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64735         for (size_t g = 0; g < ret_var.datalen; g++) {
64736                 LDKPath ret_conv_6_var = ret_var.data[g];
64737                 uint64_t ret_conv_6_ref = 0;
64738                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
64739                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
64740                 ret_arr_ptr[g] = ret_conv_6_ref;
64741         }
64742         
64743         FREE(ret_var.data);
64744         return ret_arr;
64745 }
64746
64747 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
64748         LDKRoute this_ptr_conv;
64749         this_ptr_conv.inner = untag_ptr(this_ptr);
64750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64752         this_ptr_conv.is_owned = false;
64753         LDKCVec_PathZ val_constr;
64754         val_constr.datalen = val->arr_len;
64755         if (val_constr.datalen > 0)
64756                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64757         else
64758                 val_constr.data = NULL;
64759         uint64_t* val_vals = val->elems;
64760         for (size_t g = 0; g < val_constr.datalen; g++) {
64761                 uint64_t val_conv_6 = val_vals[g];
64762                 LDKPath val_conv_6_conv;
64763                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
64764                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
64765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
64766                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
64767                 val_constr.data[g] = val_conv_6_conv;
64768         }
64769         FREE(val);
64770         Route_set_paths(&this_ptr_conv, val_constr);
64771 }
64772
64773 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
64774         LDKRoute this_ptr_conv;
64775         this_ptr_conv.inner = untag_ptr(this_ptr);
64776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64778         this_ptr_conv.is_owned = false;
64779         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
64780         uint64_t ret_ref = 0;
64781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64783         return ret_ref;
64784 }
64785
64786 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
64787         LDKRoute this_ptr_conv;
64788         this_ptr_conv.inner = untag_ptr(this_ptr);
64789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64791         this_ptr_conv.is_owned = false;
64792         LDKRouteParameters val_conv;
64793         val_conv.inner = untag_ptr(val);
64794         val_conv.is_owned = ptr_is_owned(val);
64795         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64796         val_conv = RouteParameters_clone(&val_conv);
64797         Route_set_route_params(&this_ptr_conv, val_conv);
64798 }
64799
64800 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
64801         LDKCVec_PathZ paths_arg_constr;
64802         paths_arg_constr.datalen = paths_arg->arr_len;
64803         if (paths_arg_constr.datalen > 0)
64804                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64805         else
64806                 paths_arg_constr.data = NULL;
64807         uint64_t* paths_arg_vals = paths_arg->elems;
64808         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
64809                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
64810                 LDKPath paths_arg_conv_6_conv;
64811                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
64812                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
64813                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
64814                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
64815                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
64816         }
64817         FREE(paths_arg);
64818         LDKRouteParameters route_params_arg_conv;
64819         route_params_arg_conv.inner = untag_ptr(route_params_arg);
64820         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
64821         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
64822         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
64823         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
64824         uint64_t ret_ref = 0;
64825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64827         return ret_ref;
64828 }
64829
64830 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
64831         LDKRoute ret_var = Route_clone(arg);
64832         uint64_t ret_ref = 0;
64833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64835         return ret_ref;
64836 }
64837 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
64838         LDKRoute arg_conv;
64839         arg_conv.inner = untag_ptr(arg);
64840         arg_conv.is_owned = ptr_is_owned(arg);
64841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64842         arg_conv.is_owned = false;
64843         int64_t ret_conv = Route_clone_ptr(&arg_conv);
64844         return ret_conv;
64845 }
64846
64847 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
64848         LDKRoute orig_conv;
64849         orig_conv.inner = untag_ptr(orig);
64850         orig_conv.is_owned = ptr_is_owned(orig);
64851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64852         orig_conv.is_owned = false;
64853         LDKRoute ret_var = Route_clone(&orig_conv);
64854         uint64_t ret_ref = 0;
64855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64857         return ret_ref;
64858 }
64859
64860 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
64861         LDKRoute o_conv;
64862         o_conv.inner = untag_ptr(o);
64863         o_conv.is_owned = ptr_is_owned(o);
64864         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64865         o_conv.is_owned = false;
64866         int64_t ret_conv = Route_hash(&o_conv);
64867         return ret_conv;
64868 }
64869
64870 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
64871         LDKRoute a_conv;
64872         a_conv.inner = untag_ptr(a);
64873         a_conv.is_owned = ptr_is_owned(a);
64874         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64875         a_conv.is_owned = false;
64876         LDKRoute b_conv;
64877         b_conv.inner = untag_ptr(b);
64878         b_conv.is_owned = ptr_is_owned(b);
64879         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64880         b_conv.is_owned = false;
64881         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
64882         return ret_conv;
64883 }
64884
64885 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
64886         LDKRoute this_arg_conv;
64887         this_arg_conv.inner = untag_ptr(this_arg);
64888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64890         this_arg_conv.is_owned = false;
64891         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
64892         return ret_conv;
64893 }
64894
64895 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
64896         LDKRoute this_arg_conv;
64897         this_arg_conv.inner = untag_ptr(this_arg);
64898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64900         this_arg_conv.is_owned = false;
64901         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
64902         return ret_conv;
64903 }
64904
64905 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
64906         LDKRoute obj_conv;
64907         obj_conv.inner = untag_ptr(obj);
64908         obj_conv.is_owned = ptr_is_owned(obj);
64909         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64910         obj_conv.is_owned = false;
64911         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
64912         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64913         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64914         CVec_u8Z_free(ret_var);
64915         return ret_arr;
64916 }
64917
64918 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
64919         LDKu8slice ser_ref;
64920         ser_ref.datalen = ser->arr_len;
64921         ser_ref.data = ser->elems;
64922         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
64923         *ret_conv = Route_read(ser_ref);
64924         FREE(ser);
64925         return tag_ptr(ret_conv, true);
64926 }
64927
64928 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
64929         LDKRouteParameters this_obj_conv;
64930         this_obj_conv.inner = untag_ptr(this_obj);
64931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64933         RouteParameters_free(this_obj_conv);
64934 }
64935
64936 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
64937         LDKRouteParameters this_ptr_conv;
64938         this_ptr_conv.inner = untag_ptr(this_ptr);
64939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64941         this_ptr_conv.is_owned = false;
64942         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
64943         uint64_t ret_ref = 0;
64944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64946         return ret_ref;
64947 }
64948
64949 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
64950         LDKRouteParameters this_ptr_conv;
64951         this_ptr_conv.inner = untag_ptr(this_ptr);
64952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64954         this_ptr_conv.is_owned = false;
64955         LDKPaymentParameters val_conv;
64956         val_conv.inner = untag_ptr(val);
64957         val_conv.is_owned = ptr_is_owned(val);
64958         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64959         val_conv = PaymentParameters_clone(&val_conv);
64960         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
64961 }
64962
64963 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
64964         LDKRouteParameters this_ptr_conv;
64965         this_ptr_conv.inner = untag_ptr(this_ptr);
64966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64968         this_ptr_conv.is_owned = false;
64969         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
64970         return ret_conv;
64971 }
64972
64973 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
64974         LDKRouteParameters this_ptr_conv;
64975         this_ptr_conv.inner = untag_ptr(this_ptr);
64976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64978         this_ptr_conv.is_owned = false;
64979         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
64980 }
64981
64982 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) {
64983         LDKRouteParameters this_ptr_conv;
64984         this_ptr_conv.inner = untag_ptr(this_ptr);
64985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64987         this_ptr_conv.is_owned = false;
64988         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64989         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
64990         uint64_t ret_ref = tag_ptr(ret_copy, true);
64991         return ret_ref;
64992 }
64993
64994 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) {
64995         LDKRouteParameters this_ptr_conv;
64996         this_ptr_conv.inner = untag_ptr(this_ptr);
64997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64999         this_ptr_conv.is_owned = false;
65000         void* val_ptr = untag_ptr(val);
65001         CHECK_ACCESS(val_ptr);
65002         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65003         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65004         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
65005 }
65006
65007 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) {
65008         LDKPaymentParameters payment_params_arg_conv;
65009         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
65010         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
65011         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
65012         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
65013         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
65014         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
65015         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
65016         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
65017         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
65018         uint64_t ret_ref = 0;
65019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65021         return ret_ref;
65022 }
65023
65024 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
65025         LDKRouteParameters ret_var = RouteParameters_clone(arg);
65026         uint64_t ret_ref = 0;
65027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65029         return ret_ref;
65030 }
65031 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
65032         LDKRouteParameters arg_conv;
65033         arg_conv.inner = untag_ptr(arg);
65034         arg_conv.is_owned = ptr_is_owned(arg);
65035         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65036         arg_conv.is_owned = false;
65037         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
65038         return ret_conv;
65039 }
65040
65041 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
65042         LDKRouteParameters orig_conv;
65043         orig_conv.inner = untag_ptr(orig);
65044         orig_conv.is_owned = ptr_is_owned(orig);
65045         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65046         orig_conv.is_owned = false;
65047         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
65048         uint64_t ret_ref = 0;
65049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65051         return ret_ref;
65052 }
65053
65054 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
65055         LDKRouteParameters o_conv;
65056         o_conv.inner = untag_ptr(o);
65057         o_conv.is_owned = ptr_is_owned(o);
65058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65059         o_conv.is_owned = false;
65060         int64_t ret_conv = RouteParameters_hash(&o_conv);
65061         return ret_conv;
65062 }
65063
65064 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
65065         LDKRouteParameters a_conv;
65066         a_conv.inner = untag_ptr(a);
65067         a_conv.is_owned = ptr_is_owned(a);
65068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65069         a_conv.is_owned = false;
65070         LDKRouteParameters b_conv;
65071         b_conv.inner = untag_ptr(b);
65072         b_conv.is_owned = ptr_is_owned(b);
65073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65074         b_conv.is_owned = false;
65075         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
65076         return ret_conv;
65077 }
65078
65079 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) {
65080         LDKPaymentParameters payment_params_conv;
65081         payment_params_conv.inner = untag_ptr(payment_params);
65082         payment_params_conv.is_owned = ptr_is_owned(payment_params);
65083         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
65084         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
65085         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
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 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
65093         LDKRouteParameters obj_conv;
65094         obj_conv.inner = untag_ptr(obj);
65095         obj_conv.is_owned = ptr_is_owned(obj);
65096         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65097         obj_conv.is_owned = false;
65098         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
65099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65101         CVec_u8Z_free(ret_var);
65102         return ret_arr;
65103 }
65104
65105 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
65106         LDKu8slice ser_ref;
65107         ser_ref.datalen = ser->arr_len;
65108         ser_ref.data = ser->elems;
65109         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
65110         *ret_conv = RouteParameters_read(ser_ref);
65111         FREE(ser);
65112         return tag_ptr(ret_conv, true);
65113 }
65114
65115 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
65116         LDKPaymentParameters this_obj_conv;
65117         this_obj_conv.inner = untag_ptr(this_obj);
65118         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65120         PaymentParameters_free(this_obj_conv);
65121 }
65122
65123 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
65124         LDKPaymentParameters this_ptr_conv;
65125         this_ptr_conv.inner = untag_ptr(this_ptr);
65126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65128         this_ptr_conv.is_owned = false;
65129         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65130         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
65131         uint64_t ret_ref = tag_ptr(ret_copy, true);
65132         return ret_ref;
65133 }
65134
65135 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
65136         LDKPaymentParameters this_ptr_conv;
65137         this_ptr_conv.inner = untag_ptr(this_ptr);
65138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65140         this_ptr_conv.is_owned = false;
65141         void* val_ptr = untag_ptr(val);
65142         CHECK_ACCESS(val_ptr);
65143         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
65144         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
65145         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
65146 }
65147
65148 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
65149         LDKPaymentParameters this_ptr_conv;
65150         this_ptr_conv.inner = untag_ptr(this_ptr);
65151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65153         this_ptr_conv.is_owned = false;
65154         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65155         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
65156         uint64_t ret_ref = tag_ptr(ret_copy, true);
65157         return ret_ref;
65158 }
65159
65160 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
65161         LDKPaymentParameters this_ptr_conv;
65162         this_ptr_conv.inner = untag_ptr(this_ptr);
65163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65165         this_ptr_conv.is_owned = false;
65166         void* val_ptr = untag_ptr(val);
65167         CHECK_ACCESS(val_ptr);
65168         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65169         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65170         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
65171 }
65172
65173 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) {
65174         LDKPaymentParameters this_ptr_conv;
65175         this_ptr_conv.inner = untag_ptr(this_ptr);
65176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65178         this_ptr_conv.is_owned = false;
65179         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
65180         return ret_conv;
65181 }
65182
65183 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) {
65184         LDKPaymentParameters this_ptr_conv;
65185         this_ptr_conv.inner = untag_ptr(this_ptr);
65186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65188         this_ptr_conv.is_owned = false;
65189         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
65190 }
65191
65192 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
65193         LDKPaymentParameters this_ptr_conv;
65194         this_ptr_conv.inner = untag_ptr(this_ptr);
65195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65197         this_ptr_conv.is_owned = false;
65198         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
65199         return ret_conv;
65200 }
65201
65202 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
65203         LDKPaymentParameters this_ptr_conv;
65204         this_ptr_conv.inner = untag_ptr(this_ptr);
65205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65207         this_ptr_conv.is_owned = false;
65208         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
65209 }
65210
65211 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) {
65212         LDKPaymentParameters this_ptr_conv;
65213         this_ptr_conv.inner = untag_ptr(this_ptr);
65214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65216         this_ptr_conv.is_owned = false;
65217         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
65218         return ret_conv;
65219 }
65220
65221 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) {
65222         LDKPaymentParameters this_ptr_conv;
65223         this_ptr_conv.inner = untag_ptr(this_ptr);
65224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65226         this_ptr_conv.is_owned = false;
65227         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
65228 }
65229
65230 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
65231         LDKPaymentParameters this_ptr_conv;
65232         this_ptr_conv.inner = untag_ptr(this_ptr);
65233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65235         this_ptr_conv.is_owned = false;
65236         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
65237         int64_tArray ret_arr = NULL;
65238         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65239         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65240         for (size_t i = 0; i < ret_var.datalen; i++) {
65241                 int64_t ret_conv_8_conv = ret_var.data[i];
65242                 ret_arr_ptr[i] = ret_conv_8_conv;
65243         }
65244         
65245         FREE(ret_var.data);
65246         return ret_arr;
65247 }
65248
65249 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
65250         LDKPaymentParameters this_ptr_conv;
65251         this_ptr_conv.inner = untag_ptr(this_ptr);
65252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65254         this_ptr_conv.is_owned = false;
65255         LDKCVec_u64Z val_constr;
65256         val_constr.datalen = val->arr_len;
65257         if (val_constr.datalen > 0)
65258                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65259         else
65260                 val_constr.data = NULL;
65261         int64_t* val_vals = val->elems;
65262         for (size_t i = 0; i < val_constr.datalen; i++) {
65263                 int64_t val_conv_8 = val_vals[i];
65264                 val_constr.data[i] = val_conv_8;
65265         }
65266         FREE(val);
65267         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
65268 }
65269
65270 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_blinded_path_idxs"))) TS_PaymentParameters_get_previously_failed_blinded_path_idxs(uint64_t this_ptr) {
65271         LDKPaymentParameters this_ptr_conv;
65272         this_ptr_conv.inner = untag_ptr(this_ptr);
65273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65275         this_ptr_conv.is_owned = false;
65276         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
65277         int64_tArray ret_arr = NULL;
65278         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65279         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65280         for (size_t i = 0; i < ret_var.datalen; i++) {
65281                 int64_t ret_conv_8_conv = ret_var.data[i];
65282                 ret_arr_ptr[i] = ret_conv_8_conv;
65283         }
65284         
65285         FREE(ret_var.data);
65286         return ret_arr;
65287 }
65288
65289 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_blinded_path_idxs"))) TS_PaymentParameters_set_previously_failed_blinded_path_idxs(uint64_t this_ptr, int64_tArray val) {
65290         LDKPaymentParameters this_ptr_conv;
65291         this_ptr_conv.inner = untag_ptr(this_ptr);
65292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65294         this_ptr_conv.is_owned = false;
65295         LDKCVec_u64Z val_constr;
65296         val_constr.datalen = val->arr_len;
65297         if (val_constr.datalen > 0)
65298                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65299         else
65300                 val_constr.data = NULL;
65301         int64_t* val_vals = val->elems;
65302         for (size_t i = 0; i < val_constr.datalen; i++) {
65303                 int64_t val_conv_8 = val_vals[i];
65304                 val_constr.data[i] = val_conv_8;
65305         }
65306         FREE(val);
65307         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
65308 }
65309
65310 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, int64_tArray previously_failed_blinded_path_idxs_arg) {
65311         void* payee_arg_ptr = untag_ptr(payee_arg);
65312         CHECK_ACCESS(payee_arg_ptr);
65313         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
65314         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
65315         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
65316         CHECK_ACCESS(expiry_time_arg_ptr);
65317         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
65318         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
65319         LDKCVec_u64Z previously_failed_channels_arg_constr;
65320         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
65321         if (previously_failed_channels_arg_constr.datalen > 0)
65322                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65323         else
65324                 previously_failed_channels_arg_constr.data = NULL;
65325         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
65326         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
65327                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
65328                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
65329         }
65330         FREE(previously_failed_channels_arg);
65331         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
65332         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
65333         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
65334                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65335         else
65336                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
65337         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
65338         for (size_t i = 0; i < previously_failed_blinded_path_idxs_arg_constr.datalen; i++) {
65339                 int64_t previously_failed_blinded_path_idxs_arg_conv_8 = previously_failed_blinded_path_idxs_arg_vals[i];
65340                 previously_failed_blinded_path_idxs_arg_constr.data[i] = previously_failed_blinded_path_idxs_arg_conv_8;
65341         }
65342         FREE(previously_failed_blinded_path_idxs_arg);
65343         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, previously_failed_blinded_path_idxs_arg_constr);
65344         uint64_t ret_ref = 0;
65345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65347         return ret_ref;
65348 }
65349
65350 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
65351         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
65352         uint64_t ret_ref = 0;
65353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65355         return ret_ref;
65356 }
65357 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
65358         LDKPaymentParameters arg_conv;
65359         arg_conv.inner = untag_ptr(arg);
65360         arg_conv.is_owned = ptr_is_owned(arg);
65361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65362         arg_conv.is_owned = false;
65363         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
65364         return ret_conv;
65365 }
65366
65367 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
65368         LDKPaymentParameters orig_conv;
65369         orig_conv.inner = untag_ptr(orig);
65370         orig_conv.is_owned = ptr_is_owned(orig);
65371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65372         orig_conv.is_owned = false;
65373         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
65374         uint64_t ret_ref = 0;
65375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65377         return ret_ref;
65378 }
65379
65380 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
65381         LDKPaymentParameters o_conv;
65382         o_conv.inner = untag_ptr(o);
65383         o_conv.is_owned = ptr_is_owned(o);
65384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65385         o_conv.is_owned = false;
65386         int64_t ret_conv = PaymentParameters_hash(&o_conv);
65387         return ret_conv;
65388 }
65389
65390 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
65391         LDKPaymentParameters a_conv;
65392         a_conv.inner = untag_ptr(a);
65393         a_conv.is_owned = ptr_is_owned(a);
65394         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65395         a_conv.is_owned = false;
65396         LDKPaymentParameters b_conv;
65397         b_conv.inner = untag_ptr(b);
65398         b_conv.is_owned = ptr_is_owned(b);
65399         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65400         b_conv.is_owned = false;
65401         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
65402         return ret_conv;
65403 }
65404
65405 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
65406         LDKPaymentParameters obj_conv;
65407         obj_conv.inner = untag_ptr(obj);
65408         obj_conv.is_owned = ptr_is_owned(obj);
65409         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65410         obj_conv.is_owned = false;
65411         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
65412         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65413         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65414         CVec_u8Z_free(ret_var);
65415         return ret_arr;
65416 }
65417
65418 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
65419         LDKu8slice ser_ref;
65420         ser_ref.datalen = ser->arr_len;
65421         ser_ref.data = ser->elems;
65422         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
65423         *ret_conv = PaymentParameters_read(ser_ref, arg);
65424         FREE(ser);
65425         return tag_ptr(ret_conv, true);
65426 }
65427
65428 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) {
65429         LDKPublicKey payee_pubkey_ref;
65430         CHECK(payee_pubkey->arr_len == 33);
65431         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65432         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
65433         uint64_t ret_ref = 0;
65434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65436         return ret_ref;
65437 }
65438
65439 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) {
65440         LDKPublicKey payee_pubkey_ref;
65441         CHECK(payee_pubkey->arr_len == 33);
65442         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65443         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
65444         uint64_t ret_ref = 0;
65445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65447         return ret_ref;
65448 }
65449
65450 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
65451         LDKBolt12Invoice invoice_conv;
65452         invoice_conv.inner = untag_ptr(invoice);
65453         invoice_conv.is_owned = ptr_is_owned(invoice);
65454         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
65455         invoice_conv.is_owned = false;
65456         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
65457         uint64_t ret_ref = 0;
65458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65460         return ret_ref;
65461 }
65462
65463 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
65464         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
65465         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
65466         if (blinded_route_hints_constr.datalen > 0)
65467                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65468         else
65469                 blinded_route_hints_constr.data = NULL;
65470         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
65471         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
65472                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
65473                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
65474                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
65475                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
65476                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
65477                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
65478         }
65479         FREE(blinded_route_hints);
65480         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
65481         uint64_t ret_ref = 0;
65482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65484         return ret_ref;
65485 }
65486
65487 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
65488         if (!ptr_is_owned(this_ptr)) return;
65489         void* this_ptr_ptr = untag_ptr(this_ptr);
65490         CHECK_ACCESS(this_ptr_ptr);
65491         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
65492         FREE(untag_ptr(this_ptr));
65493         Payee_free(this_ptr_conv);
65494 }
65495
65496 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
65497         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65498         *ret_copy = Payee_clone(arg);
65499         uint64_t ret_ref = tag_ptr(ret_copy, true);
65500         return ret_ref;
65501 }
65502 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
65503         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
65504         int64_t ret_conv = Payee_clone_ptr(arg_conv);
65505         return ret_conv;
65506 }
65507
65508 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
65509         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
65510         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65511         *ret_copy = Payee_clone(orig_conv);
65512         uint64_t ret_ref = tag_ptr(ret_copy, true);
65513         return ret_ref;
65514 }
65515
65516 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
65517         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
65518         route_hints_constr.datalen = route_hints->arr_len;
65519         if (route_hints_constr.datalen > 0)
65520                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65521         else
65522                 route_hints_constr.data = NULL;
65523         uint64_t* route_hints_vals = route_hints->elems;
65524         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65525                 uint64_t route_hints_conv_37 = route_hints_vals[l];
65526                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
65527                 CHECK_ACCESS(route_hints_conv_37_ptr);
65528                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
65529                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
65530                 route_hints_constr.data[l] = route_hints_conv_37_conv;
65531         }
65532         FREE(route_hints);
65533         LDKBolt12InvoiceFeatures features_conv;
65534         features_conv.inner = untag_ptr(features);
65535         features_conv.is_owned = ptr_is_owned(features);
65536         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65537         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
65538         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65539         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
65540         uint64_t ret_ref = tag_ptr(ret_copy, true);
65541         return ret_ref;
65542 }
65543
65544 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) {
65545         LDKPublicKey node_id_ref;
65546         CHECK(node_id->arr_len == 33);
65547         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65548         LDKCVec_RouteHintZ route_hints_constr;
65549         route_hints_constr.datalen = route_hints->arr_len;
65550         if (route_hints_constr.datalen > 0)
65551                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
65552         else
65553                 route_hints_constr.data = NULL;
65554         uint64_t* route_hints_vals = route_hints->elems;
65555         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65556                 uint64_t route_hints_conv_11 = route_hints_vals[l];
65557                 LDKRouteHint route_hints_conv_11_conv;
65558                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
65559                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
65560                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
65561                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
65562                 route_hints_constr.data[l] = route_hints_conv_11_conv;
65563         }
65564         FREE(route_hints);
65565         LDKBolt11InvoiceFeatures features_conv;
65566         features_conv.inner = untag_ptr(features);
65567         features_conv.is_owned = ptr_is_owned(features);
65568         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65569         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
65570         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65571         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
65572         uint64_t ret_ref = tag_ptr(ret_copy, true);
65573         return ret_ref;
65574 }
65575
65576 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
65577         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
65578         int64_t ret_conv = Payee_hash(o_conv);
65579         return ret_conv;
65580 }
65581
65582 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
65583         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
65584         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
65585         jboolean ret_conv = Payee_eq(a_conv, b_conv);
65586         return ret_conv;
65587 }
65588
65589 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
65590         LDKRouteHint this_obj_conv;
65591         this_obj_conv.inner = untag_ptr(this_obj);
65592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65594         RouteHint_free(this_obj_conv);
65595 }
65596
65597 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
65598         LDKRouteHint this_ptr_conv;
65599         this_ptr_conv.inner = untag_ptr(this_ptr);
65600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65602         this_ptr_conv.is_owned = false;
65603         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
65604         uint64_tArray ret_arr = NULL;
65605         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
65606         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
65607         for (size_t o = 0; o < ret_var.datalen; o++) {
65608                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
65609                 uint64_t ret_conv_14_ref = 0;
65610                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
65611                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
65612                 ret_arr_ptr[o] = ret_conv_14_ref;
65613         }
65614         
65615         FREE(ret_var.data);
65616         return ret_arr;
65617 }
65618
65619 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
65620         LDKRouteHint this_ptr_conv;
65621         this_ptr_conv.inner = untag_ptr(this_ptr);
65622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65624         this_ptr_conv.is_owned = false;
65625         LDKCVec_RouteHintHopZ val_constr;
65626         val_constr.datalen = val->arr_len;
65627         if (val_constr.datalen > 0)
65628                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65629         else
65630                 val_constr.data = NULL;
65631         uint64_t* val_vals = val->elems;
65632         for (size_t o = 0; o < val_constr.datalen; o++) {
65633                 uint64_t val_conv_14 = val_vals[o];
65634                 LDKRouteHintHop val_conv_14_conv;
65635                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
65636                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
65637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
65638                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
65639                 val_constr.data[o] = val_conv_14_conv;
65640         }
65641         FREE(val);
65642         RouteHint_set_a(&this_ptr_conv, val_constr);
65643 }
65644
65645 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
65646         LDKCVec_RouteHintHopZ a_arg_constr;
65647         a_arg_constr.datalen = a_arg->arr_len;
65648         if (a_arg_constr.datalen > 0)
65649                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65650         else
65651                 a_arg_constr.data = NULL;
65652         uint64_t* a_arg_vals = a_arg->elems;
65653         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
65654                 uint64_t a_arg_conv_14 = a_arg_vals[o];
65655                 LDKRouteHintHop a_arg_conv_14_conv;
65656                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
65657                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
65658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
65659                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
65660                 a_arg_constr.data[o] = a_arg_conv_14_conv;
65661         }
65662         FREE(a_arg);
65663         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
65664         uint64_t ret_ref = 0;
65665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65667         return ret_ref;
65668 }
65669
65670 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
65671         LDKRouteHint ret_var = RouteHint_clone(arg);
65672         uint64_t ret_ref = 0;
65673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65675         return ret_ref;
65676 }
65677 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
65678         LDKRouteHint arg_conv;
65679         arg_conv.inner = untag_ptr(arg);
65680         arg_conv.is_owned = ptr_is_owned(arg);
65681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65682         arg_conv.is_owned = false;
65683         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
65684         return ret_conv;
65685 }
65686
65687 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
65688         LDKRouteHint orig_conv;
65689         orig_conv.inner = untag_ptr(orig);
65690         orig_conv.is_owned = ptr_is_owned(orig);
65691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65692         orig_conv.is_owned = false;
65693         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
65694         uint64_t ret_ref = 0;
65695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65697         return ret_ref;
65698 }
65699
65700 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
65701         LDKRouteHint o_conv;
65702         o_conv.inner = untag_ptr(o);
65703         o_conv.is_owned = ptr_is_owned(o);
65704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65705         o_conv.is_owned = false;
65706         int64_t ret_conv = RouteHint_hash(&o_conv);
65707         return ret_conv;
65708 }
65709
65710 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
65711         LDKRouteHint a_conv;
65712         a_conv.inner = untag_ptr(a);
65713         a_conv.is_owned = ptr_is_owned(a);
65714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65715         a_conv.is_owned = false;
65716         LDKRouteHint b_conv;
65717         b_conv.inner = untag_ptr(b);
65718         b_conv.is_owned = ptr_is_owned(b);
65719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65720         b_conv.is_owned = false;
65721         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
65722         return ret_conv;
65723 }
65724
65725 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
65726         LDKRouteHint obj_conv;
65727         obj_conv.inner = untag_ptr(obj);
65728         obj_conv.is_owned = ptr_is_owned(obj);
65729         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65730         obj_conv.is_owned = false;
65731         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
65732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65734         CVec_u8Z_free(ret_var);
65735         return ret_arr;
65736 }
65737
65738 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
65739         LDKu8slice ser_ref;
65740         ser_ref.datalen = ser->arr_len;
65741         ser_ref.data = ser->elems;
65742         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
65743         *ret_conv = RouteHint_read(ser_ref);
65744         FREE(ser);
65745         return tag_ptr(ret_conv, true);
65746 }
65747
65748 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
65749         LDKRouteHintHop this_obj_conv;
65750         this_obj_conv.inner = untag_ptr(this_obj);
65751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65753         RouteHintHop_free(this_obj_conv);
65754 }
65755
65756 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
65757         LDKRouteHintHop this_ptr_conv;
65758         this_ptr_conv.inner = untag_ptr(this_ptr);
65759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65761         this_ptr_conv.is_owned = false;
65762         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65763         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
65764         return ret_arr;
65765 }
65766
65767 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
65768         LDKRouteHintHop this_ptr_conv;
65769         this_ptr_conv.inner = untag_ptr(this_ptr);
65770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65772         this_ptr_conv.is_owned = false;
65773         LDKPublicKey val_ref;
65774         CHECK(val->arr_len == 33);
65775         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
65776         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
65777 }
65778
65779 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
65780         LDKRouteHintHop this_ptr_conv;
65781         this_ptr_conv.inner = untag_ptr(this_ptr);
65782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65784         this_ptr_conv.is_owned = false;
65785         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
65786         return ret_conv;
65787 }
65788
65789 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
65790         LDKRouteHintHop this_ptr_conv;
65791         this_ptr_conv.inner = untag_ptr(this_ptr);
65792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65794         this_ptr_conv.is_owned = false;
65795         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
65796 }
65797
65798 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
65799         LDKRouteHintHop this_ptr_conv;
65800         this_ptr_conv.inner = untag_ptr(this_ptr);
65801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65803         this_ptr_conv.is_owned = false;
65804         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
65805         uint64_t ret_ref = 0;
65806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65808         return ret_ref;
65809 }
65810
65811 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
65812         LDKRouteHintHop this_ptr_conv;
65813         this_ptr_conv.inner = untag_ptr(this_ptr);
65814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65816         this_ptr_conv.is_owned = false;
65817         LDKRoutingFees val_conv;
65818         val_conv.inner = untag_ptr(val);
65819         val_conv.is_owned = ptr_is_owned(val);
65820         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65821         val_conv = RoutingFees_clone(&val_conv);
65822         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
65823 }
65824
65825 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
65826         LDKRouteHintHop this_ptr_conv;
65827         this_ptr_conv.inner = untag_ptr(this_ptr);
65828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65830         this_ptr_conv.is_owned = false;
65831         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
65832         return ret_conv;
65833 }
65834
65835 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
65836         LDKRouteHintHop this_ptr_conv;
65837         this_ptr_conv.inner = untag_ptr(this_ptr);
65838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65840         this_ptr_conv.is_owned = false;
65841         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
65842 }
65843
65844 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
65845         LDKRouteHintHop this_ptr_conv;
65846         this_ptr_conv.inner = untag_ptr(this_ptr);
65847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65849         this_ptr_conv.is_owned = false;
65850         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65851         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
65852         uint64_t ret_ref = tag_ptr(ret_copy, true);
65853         return ret_ref;
65854 }
65855
65856 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
65857         LDKRouteHintHop this_ptr_conv;
65858         this_ptr_conv.inner = untag_ptr(this_ptr);
65859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65861         this_ptr_conv.is_owned = false;
65862         void* val_ptr = untag_ptr(val);
65863         CHECK_ACCESS(val_ptr);
65864         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65865         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65866         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
65867 }
65868
65869 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
65870         LDKRouteHintHop this_ptr_conv;
65871         this_ptr_conv.inner = untag_ptr(this_ptr);
65872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65874         this_ptr_conv.is_owned = false;
65875         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65876         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
65877         uint64_t ret_ref = tag_ptr(ret_copy, true);
65878         return ret_ref;
65879 }
65880
65881 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
65882         LDKRouteHintHop this_ptr_conv;
65883         this_ptr_conv.inner = untag_ptr(this_ptr);
65884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65886         this_ptr_conv.is_owned = false;
65887         void* val_ptr = untag_ptr(val);
65888         CHECK_ACCESS(val_ptr);
65889         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65890         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65891         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
65892 }
65893
65894 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) {
65895         LDKPublicKey src_node_id_arg_ref;
65896         CHECK(src_node_id_arg->arr_len == 33);
65897         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
65898         LDKRoutingFees fees_arg_conv;
65899         fees_arg_conv.inner = untag_ptr(fees_arg);
65900         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
65901         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
65902         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
65903         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
65904         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
65905         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
65906         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
65907         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
65908         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
65909         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
65910         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
65911         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);
65912         uint64_t ret_ref = 0;
65913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65915         return ret_ref;
65916 }
65917
65918 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
65919         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
65920         uint64_t ret_ref = 0;
65921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65923         return ret_ref;
65924 }
65925 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
65926         LDKRouteHintHop arg_conv;
65927         arg_conv.inner = untag_ptr(arg);
65928         arg_conv.is_owned = ptr_is_owned(arg);
65929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65930         arg_conv.is_owned = false;
65931         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
65932         return ret_conv;
65933 }
65934
65935 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
65936         LDKRouteHintHop orig_conv;
65937         orig_conv.inner = untag_ptr(orig);
65938         orig_conv.is_owned = ptr_is_owned(orig);
65939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65940         orig_conv.is_owned = false;
65941         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
65942         uint64_t ret_ref = 0;
65943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65945         return ret_ref;
65946 }
65947
65948 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
65949         LDKRouteHintHop o_conv;
65950         o_conv.inner = untag_ptr(o);
65951         o_conv.is_owned = ptr_is_owned(o);
65952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65953         o_conv.is_owned = false;
65954         int64_t ret_conv = RouteHintHop_hash(&o_conv);
65955         return ret_conv;
65956 }
65957
65958 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
65959         LDKRouteHintHop a_conv;
65960         a_conv.inner = untag_ptr(a);
65961         a_conv.is_owned = ptr_is_owned(a);
65962         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65963         a_conv.is_owned = false;
65964         LDKRouteHintHop b_conv;
65965         b_conv.inner = untag_ptr(b);
65966         b_conv.is_owned = ptr_is_owned(b);
65967         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65968         b_conv.is_owned = false;
65969         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
65970         return ret_conv;
65971 }
65972
65973 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
65974         LDKRouteHintHop obj_conv;
65975         obj_conv.inner = untag_ptr(obj);
65976         obj_conv.is_owned = ptr_is_owned(obj);
65977         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65978         obj_conv.is_owned = false;
65979         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
65980         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65981         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65982         CVec_u8Z_free(ret_var);
65983         return ret_arr;
65984 }
65985
65986 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
65987         LDKu8slice ser_ref;
65988         ser_ref.datalen = ser->arr_len;
65989         ser_ref.data = ser->elems;
65990         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
65991         *ret_conv = RouteHintHop_read(ser_ref);
65992         FREE(ser);
65993         return tag_ptr(ret_conv, true);
65994 }
65995
65996 void  __attribute__((export_name("TS_FirstHopCandidate_free"))) TS_FirstHopCandidate_free(uint64_t this_obj) {
65997         LDKFirstHopCandidate this_obj_conv;
65998         this_obj_conv.inner = untag_ptr(this_obj);
65999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66001         FirstHopCandidate_free(this_obj_conv);
66002 }
66003
66004 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
66005         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
66006         uint64_t ret_ref = 0;
66007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66009         return ret_ref;
66010 }
66011 int64_t  __attribute__((export_name("TS_FirstHopCandidate_clone_ptr"))) TS_FirstHopCandidate_clone_ptr(uint64_t arg) {
66012         LDKFirstHopCandidate arg_conv;
66013         arg_conv.inner = untag_ptr(arg);
66014         arg_conv.is_owned = ptr_is_owned(arg);
66015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66016         arg_conv.is_owned = false;
66017         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
66018         return ret_conv;
66019 }
66020
66021 uint64_t  __attribute__((export_name("TS_FirstHopCandidate_clone"))) TS_FirstHopCandidate_clone(uint64_t orig) {
66022         LDKFirstHopCandidate orig_conv;
66023         orig_conv.inner = untag_ptr(orig);
66024         orig_conv.is_owned = ptr_is_owned(orig);
66025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66026         orig_conv.is_owned = false;
66027         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
66028         uint64_t ret_ref = 0;
66029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66031         return ret_ref;
66032 }
66033
66034 void  __attribute__((export_name("TS_PublicHopCandidate_free"))) TS_PublicHopCandidate_free(uint64_t this_obj) {
66035         LDKPublicHopCandidate this_obj_conv;
66036         this_obj_conv.inner = untag_ptr(this_obj);
66037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66039         PublicHopCandidate_free(this_obj_conv);
66040 }
66041
66042 int64_t  __attribute__((export_name("TS_PublicHopCandidate_get_short_channel_id"))) TS_PublicHopCandidate_get_short_channel_id(uint64_t this_ptr) {
66043         LDKPublicHopCandidate this_ptr_conv;
66044         this_ptr_conv.inner = untag_ptr(this_ptr);
66045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66047         this_ptr_conv.is_owned = false;
66048         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
66049         return ret_conv;
66050 }
66051
66052 void  __attribute__((export_name("TS_PublicHopCandidate_set_short_channel_id"))) TS_PublicHopCandidate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
66053         LDKPublicHopCandidate this_ptr_conv;
66054         this_ptr_conv.inner = untag_ptr(this_ptr);
66055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66057         this_ptr_conv.is_owned = false;
66058         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
66059 }
66060
66061 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
66062         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
66063         uint64_t ret_ref = 0;
66064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66066         return ret_ref;
66067 }
66068 int64_t  __attribute__((export_name("TS_PublicHopCandidate_clone_ptr"))) TS_PublicHopCandidate_clone_ptr(uint64_t arg) {
66069         LDKPublicHopCandidate arg_conv;
66070         arg_conv.inner = untag_ptr(arg);
66071         arg_conv.is_owned = ptr_is_owned(arg);
66072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66073         arg_conv.is_owned = false;
66074         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
66075         return ret_conv;
66076 }
66077
66078 uint64_t  __attribute__((export_name("TS_PublicHopCandidate_clone"))) TS_PublicHopCandidate_clone(uint64_t orig) {
66079         LDKPublicHopCandidate orig_conv;
66080         orig_conv.inner = untag_ptr(orig);
66081         orig_conv.is_owned = ptr_is_owned(orig);
66082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66083         orig_conv.is_owned = false;
66084         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
66085         uint64_t ret_ref = 0;
66086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66088         return ret_ref;
66089 }
66090
66091 void  __attribute__((export_name("TS_PrivateHopCandidate_free"))) TS_PrivateHopCandidate_free(uint64_t this_obj) {
66092         LDKPrivateHopCandidate this_obj_conv;
66093         this_obj_conv.inner = untag_ptr(this_obj);
66094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66096         PrivateHopCandidate_free(this_obj_conv);
66097 }
66098
66099 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
66100         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
66101         uint64_t ret_ref = 0;
66102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66104         return ret_ref;
66105 }
66106 int64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone_ptr"))) TS_PrivateHopCandidate_clone_ptr(uint64_t arg) {
66107         LDKPrivateHopCandidate arg_conv;
66108         arg_conv.inner = untag_ptr(arg);
66109         arg_conv.is_owned = ptr_is_owned(arg);
66110         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66111         arg_conv.is_owned = false;
66112         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
66113         return ret_conv;
66114 }
66115
66116 uint64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone"))) TS_PrivateHopCandidate_clone(uint64_t orig) {
66117         LDKPrivateHopCandidate orig_conv;
66118         orig_conv.inner = untag_ptr(orig);
66119         orig_conv.is_owned = ptr_is_owned(orig);
66120         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66121         orig_conv.is_owned = false;
66122         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
66123         uint64_t ret_ref = 0;
66124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66126         return ret_ref;
66127 }
66128
66129 void  __attribute__((export_name("TS_BlindedPathCandidate_free"))) TS_BlindedPathCandidate_free(uint64_t this_obj) {
66130         LDKBlindedPathCandidate this_obj_conv;
66131         this_obj_conv.inner = untag_ptr(this_obj);
66132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66134         BlindedPathCandidate_free(this_obj_conv);
66135 }
66136
66137 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
66138         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
66139         uint64_t ret_ref = 0;
66140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66142         return ret_ref;
66143 }
66144 int64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone_ptr"))) TS_BlindedPathCandidate_clone_ptr(uint64_t arg) {
66145         LDKBlindedPathCandidate arg_conv;
66146         arg_conv.inner = untag_ptr(arg);
66147         arg_conv.is_owned = ptr_is_owned(arg);
66148         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66149         arg_conv.is_owned = false;
66150         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
66151         return ret_conv;
66152 }
66153
66154 uint64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone"))) TS_BlindedPathCandidate_clone(uint64_t orig) {
66155         LDKBlindedPathCandidate orig_conv;
66156         orig_conv.inner = untag_ptr(orig);
66157         orig_conv.is_owned = ptr_is_owned(orig);
66158         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66159         orig_conv.is_owned = false;
66160         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
66161         uint64_t ret_ref = 0;
66162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66164         return ret_ref;
66165 }
66166
66167 void  __attribute__((export_name("TS_OneHopBlindedPathCandidate_free"))) TS_OneHopBlindedPathCandidate_free(uint64_t this_obj) {
66168         LDKOneHopBlindedPathCandidate this_obj_conv;
66169         this_obj_conv.inner = untag_ptr(this_obj);
66170         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66172         OneHopBlindedPathCandidate_free(this_obj_conv);
66173 }
66174
66175 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
66176         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
66177         uint64_t ret_ref = 0;
66178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66180         return ret_ref;
66181 }
66182 int64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone_ptr"))) TS_OneHopBlindedPathCandidate_clone_ptr(uint64_t arg) {
66183         LDKOneHopBlindedPathCandidate arg_conv;
66184         arg_conv.inner = untag_ptr(arg);
66185         arg_conv.is_owned = ptr_is_owned(arg);
66186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66187         arg_conv.is_owned = false;
66188         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
66189         return ret_conv;
66190 }
66191
66192 uint64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone"))) TS_OneHopBlindedPathCandidate_clone(uint64_t orig) {
66193         LDKOneHopBlindedPathCandidate orig_conv;
66194         orig_conv.inner = untag_ptr(orig);
66195         orig_conv.is_owned = ptr_is_owned(orig);
66196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66197         orig_conv.is_owned = false;
66198         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
66199         uint64_t ret_ref = 0;
66200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66202         return ret_ref;
66203 }
66204
66205 void  __attribute__((export_name("TS_CandidateRouteHop_free"))) TS_CandidateRouteHop_free(uint64_t this_ptr) {
66206         if (!ptr_is_owned(this_ptr)) return;
66207         void* this_ptr_ptr = untag_ptr(this_ptr);
66208         CHECK_ACCESS(this_ptr_ptr);
66209         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
66210         FREE(untag_ptr(this_ptr));
66211         CandidateRouteHop_free(this_ptr_conv);
66212 }
66213
66214 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
66215         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66216         *ret_copy = CandidateRouteHop_clone(arg);
66217         uint64_t ret_ref = tag_ptr(ret_copy, true);
66218         return ret_ref;
66219 }
66220 int64_t  __attribute__((export_name("TS_CandidateRouteHop_clone_ptr"))) TS_CandidateRouteHop_clone_ptr(uint64_t arg) {
66221         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
66222         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
66223         return ret_conv;
66224 }
66225
66226 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_clone"))) TS_CandidateRouteHop_clone(uint64_t orig) {
66227         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
66228         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66229         *ret_copy = CandidateRouteHop_clone(orig_conv);
66230         uint64_t ret_ref = tag_ptr(ret_copy, true);
66231         return ret_ref;
66232 }
66233
66234 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_first_hop"))) TS_CandidateRouteHop_first_hop(uint64_t a) {
66235         LDKFirstHopCandidate a_conv;
66236         a_conv.inner = untag_ptr(a);
66237         a_conv.is_owned = ptr_is_owned(a);
66238         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66239         a_conv = FirstHopCandidate_clone(&a_conv);
66240         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66241         *ret_copy = CandidateRouteHop_first_hop(a_conv);
66242         uint64_t ret_ref = tag_ptr(ret_copy, true);
66243         return ret_ref;
66244 }
66245
66246 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_public_hop"))) TS_CandidateRouteHop_public_hop(uint64_t a) {
66247         LDKPublicHopCandidate a_conv;
66248         a_conv.inner = untag_ptr(a);
66249         a_conv.is_owned = ptr_is_owned(a);
66250         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66251         a_conv = PublicHopCandidate_clone(&a_conv);
66252         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66253         *ret_copy = CandidateRouteHop_public_hop(a_conv);
66254         uint64_t ret_ref = tag_ptr(ret_copy, true);
66255         return ret_ref;
66256 }
66257
66258 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_private_hop"))) TS_CandidateRouteHop_private_hop(uint64_t a) {
66259         LDKPrivateHopCandidate a_conv;
66260         a_conv.inner = untag_ptr(a);
66261         a_conv.is_owned = ptr_is_owned(a);
66262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66263         a_conv = PrivateHopCandidate_clone(&a_conv);
66264         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66265         *ret_copy = CandidateRouteHop_private_hop(a_conv);
66266         uint64_t ret_ref = tag_ptr(ret_copy, true);
66267         return ret_ref;
66268 }
66269
66270 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_blinded"))) TS_CandidateRouteHop_blinded(uint64_t a) {
66271         LDKBlindedPathCandidate a_conv;
66272         a_conv.inner = untag_ptr(a);
66273         a_conv.is_owned = ptr_is_owned(a);
66274         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66275         a_conv = BlindedPathCandidate_clone(&a_conv);
66276         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66277         *ret_copy = CandidateRouteHop_blinded(a_conv);
66278         uint64_t ret_ref = tag_ptr(ret_copy, true);
66279         return ret_ref;
66280 }
66281
66282 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_one_hop_blinded"))) TS_CandidateRouteHop_one_hop_blinded(uint64_t a) {
66283         LDKOneHopBlindedPathCandidate a_conv;
66284         a_conv.inner = untag_ptr(a);
66285         a_conv.is_owned = ptr_is_owned(a);
66286         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66287         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
66288         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66289         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
66290         uint64_t ret_ref = tag_ptr(ret_copy, true);
66291         return ret_ref;
66292 }
66293
66294 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_globally_unique_short_channel_id"))) TS_CandidateRouteHop_globally_unique_short_channel_id(uint64_t this_arg) {
66295         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66296         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66297         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
66298         uint64_t ret_ref = tag_ptr(ret_copy, true);
66299         return ret_ref;
66300 }
66301
66302 int32_t  __attribute__((export_name("TS_CandidateRouteHop_cltv_expiry_delta"))) TS_CandidateRouteHop_cltv_expiry_delta(uint64_t this_arg) {
66303         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66304         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
66305         return ret_conv;
66306 }
66307
66308 int64_t  __attribute__((export_name("TS_CandidateRouteHop_htlc_minimum_msat"))) TS_CandidateRouteHop_htlc_minimum_msat(uint64_t this_arg) {
66309         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66310         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
66311         return ret_conv;
66312 }
66313
66314 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_fees"))) TS_CandidateRouteHop_fees(uint64_t this_arg) {
66315         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66316         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
66317         uint64_t ret_ref = 0;
66318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66320         return ret_ref;
66321 }
66322
66323 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_source"))) TS_CandidateRouteHop_source(uint64_t this_arg) {
66324         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66325         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
66326         uint64_t ret_ref = 0;
66327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66329         return ret_ref;
66330 }
66331
66332 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_target"))) TS_CandidateRouteHop_target(uint64_t this_arg) {
66333         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66334         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
66335         uint64_t ret_ref = 0;
66336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66338         return ret_ref;
66339 }
66340
66341 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) {
66342         LDKPublicKey our_node_pubkey_ref;
66343         CHECK(our_node_pubkey->arr_len == 33);
66344         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66345         LDKRouteParameters route_params_conv;
66346         route_params_conv.inner = untag_ptr(route_params);
66347         route_params_conv.is_owned = ptr_is_owned(route_params);
66348         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66349         route_params_conv.is_owned = false;
66350         LDKNetworkGraph network_graph_conv;
66351         network_graph_conv.inner = untag_ptr(network_graph);
66352         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66353         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66354         network_graph_conv.is_owned = false;
66355         LDKCVec_ChannelDetailsZ first_hops_constr;
66356         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
66357         if (first_hops != 0) {
66358                 first_hops_constr.datalen = first_hops->arr_len;
66359                 if (first_hops_constr.datalen > 0)
66360                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
66361                 else
66362                         first_hops_constr.data = NULL;
66363                 uint64_t* first_hops_vals = first_hops->elems;
66364                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
66365                         uint64_t first_hops_conv_16 = first_hops_vals[q];
66366                         LDKChannelDetails first_hops_conv_16_conv;
66367                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
66368                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
66369                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
66370                         first_hops_conv_16_conv.is_owned = false;
66371                         first_hops_constr.data[q] = first_hops_conv_16_conv;
66372                 }
66373                 FREE(first_hops);
66374                 first_hops_ptr = &first_hops_constr;
66375         }
66376         void* logger_ptr = untag_ptr(logger);
66377         CHECK_ACCESS(logger_ptr);
66378         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66379         if (logger_conv.free == LDKLogger_JCalls_free) {
66380                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66381                 LDKLogger_JCalls_cloned(&logger_conv);
66382         }
66383         void* scorer_ptr = untag_ptr(scorer);
66384         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
66385         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
66386         LDKProbabilisticScoringFeeParameters score_params_conv;
66387         score_params_conv.inner = untag_ptr(score_params);
66388         score_params_conv.is_owned = ptr_is_owned(score_params);
66389         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
66390         score_params_conv.is_owned = false;
66391         uint8_t random_seed_bytes_arr[32];
66392         CHECK(random_seed_bytes->arr_len == 32);
66393         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66394         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66395         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66396         *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);
66397         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
66398         return tag_ptr(ret_conv, true);
66399 }
66400
66401 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) {
66402         LDKPublicKey our_node_pubkey_ref;
66403         CHECK(our_node_pubkey->arr_len == 33);
66404         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66405         LDKCVec_PublicKeyZ hops_constr;
66406         hops_constr.datalen = hops->arr_len;
66407         if (hops_constr.datalen > 0)
66408                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
66409         else
66410                 hops_constr.data = NULL;
66411         int8_tArray* hops_vals = (void*) hops->elems;
66412         for (size_t m = 0; m < hops_constr.datalen; m++) {
66413                 int8_tArray hops_conv_12 = hops_vals[m];
66414                 LDKPublicKey hops_conv_12_ref;
66415                 CHECK(hops_conv_12->arr_len == 33);
66416                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
66417                 hops_constr.data[m] = hops_conv_12_ref;
66418         }
66419         FREE(hops);
66420         LDKRouteParameters route_params_conv;
66421         route_params_conv.inner = untag_ptr(route_params);
66422         route_params_conv.is_owned = ptr_is_owned(route_params);
66423         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66424         route_params_conv.is_owned = false;
66425         LDKNetworkGraph network_graph_conv;
66426         network_graph_conv.inner = untag_ptr(network_graph);
66427         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66429         network_graph_conv.is_owned = false;
66430         void* logger_ptr = untag_ptr(logger);
66431         CHECK_ACCESS(logger_ptr);
66432         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66433         if (logger_conv.free == LDKLogger_JCalls_free) {
66434                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66435                 LDKLogger_JCalls_cloned(&logger_conv);
66436         }
66437         uint8_t random_seed_bytes_arr[32];
66438         CHECK(random_seed_bytes->arr_len == 32);
66439         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66440         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66441         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66442         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
66443         return tag_ptr(ret_conv, true);
66444 }
66445
66446 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
66447         if (!ptr_is_owned(this_ptr)) return;
66448         void* this_ptr_ptr = untag_ptr(this_ptr);
66449         CHECK_ACCESS(this_ptr_ptr);
66450         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
66451         FREE(untag_ptr(this_ptr));
66452         ScoreLookUp_free(this_ptr_conv);
66453 }
66454
66455 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
66456         if (!ptr_is_owned(this_ptr)) return;
66457         void* this_ptr_ptr = untag_ptr(this_ptr);
66458         CHECK_ACCESS(this_ptr_ptr);
66459         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
66460         FREE(untag_ptr(this_ptr));
66461         ScoreUpdate_free(this_ptr_conv);
66462 }
66463
66464 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
66465         if (!ptr_is_owned(this_ptr)) return;
66466         void* this_ptr_ptr = untag_ptr(this_ptr);
66467         CHECK_ACCESS(this_ptr_ptr);
66468         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
66469         FREE(untag_ptr(this_ptr));
66470         Score_free(this_ptr_conv);
66471 }
66472
66473 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
66474         if (!ptr_is_owned(this_ptr)) return;
66475         void* this_ptr_ptr = untag_ptr(this_ptr);
66476         CHECK_ACCESS(this_ptr_ptr);
66477         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
66478         FREE(untag_ptr(this_ptr));
66479         LockableScore_free(this_ptr_conv);
66480 }
66481
66482 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
66483         if (!ptr_is_owned(this_ptr)) return;
66484         void* this_ptr_ptr = untag_ptr(this_ptr);
66485         CHECK_ACCESS(this_ptr_ptr);
66486         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
66487         FREE(untag_ptr(this_ptr));
66488         WriteableScore_free(this_ptr_conv);
66489 }
66490
66491 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
66492         LDKMultiThreadedLockableScore this_obj_conv;
66493         this_obj_conv.inner = untag_ptr(this_obj);
66494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66496         MultiThreadedLockableScore_free(this_obj_conv);
66497 }
66498
66499 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
66500         LDKMultiThreadedLockableScore this_arg_conv;
66501         this_arg_conv.inner = untag_ptr(this_arg);
66502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66504         this_arg_conv.is_owned = false;
66505         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
66506         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
66507         return tag_ptr(ret_ret, true);
66508 }
66509
66510 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
66511         LDKMultiThreadedLockableScore obj_conv;
66512         obj_conv.inner = untag_ptr(obj);
66513         obj_conv.is_owned = ptr_is_owned(obj);
66514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66515         obj_conv.is_owned = false;
66516         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
66517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66519         CVec_u8Z_free(ret_var);
66520         return ret_arr;
66521 }
66522
66523 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
66524         LDKMultiThreadedLockableScore this_arg_conv;
66525         this_arg_conv.inner = untag_ptr(this_arg);
66526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66528         this_arg_conv.is_owned = false;
66529         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
66530         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
66531         return tag_ptr(ret_ret, true);
66532 }
66533
66534 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
66535         void* score_ptr = untag_ptr(score);
66536         CHECK_ACCESS(score_ptr);
66537         LDKScore score_conv = *(LDKScore*)(score_ptr);
66538         if (score_conv.free == LDKScore_JCalls_free) {
66539                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66540                 LDKScore_JCalls_cloned(&score_conv);
66541         }
66542         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
66543         uint64_t ret_ref = 0;
66544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66546         return ret_ref;
66547 }
66548
66549 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
66550         LDKMultiThreadedScoreLockRead this_obj_conv;
66551         this_obj_conv.inner = untag_ptr(this_obj);
66552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66554         MultiThreadedScoreLockRead_free(this_obj_conv);
66555 }
66556
66557 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
66558         LDKMultiThreadedScoreLockWrite this_obj_conv;
66559         this_obj_conv.inner = untag_ptr(this_obj);
66560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66562         MultiThreadedScoreLockWrite_free(this_obj_conv);
66563 }
66564
66565 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
66566         LDKMultiThreadedScoreLockRead this_arg_conv;
66567         this_arg_conv.inner = untag_ptr(this_arg);
66568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66570         this_arg_conv.is_owned = false;
66571         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66572         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
66573         return tag_ptr(ret_ret, true);
66574 }
66575
66576 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
66577         LDKMultiThreadedScoreLockWrite obj_conv;
66578         obj_conv.inner = untag_ptr(obj);
66579         obj_conv.is_owned = ptr_is_owned(obj);
66580         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66581         obj_conv.is_owned = false;
66582         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
66583         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66584         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66585         CVec_u8Z_free(ret_var);
66586         return ret_arr;
66587 }
66588
66589 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
66590         LDKMultiThreadedScoreLockWrite this_arg_conv;
66591         this_arg_conv.inner = untag_ptr(this_arg);
66592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66594         this_arg_conv.is_owned = false;
66595         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66596         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
66597         return tag_ptr(ret_ret, true);
66598 }
66599
66600 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
66601         LDKChannelUsage this_obj_conv;
66602         this_obj_conv.inner = untag_ptr(this_obj);
66603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66605         ChannelUsage_free(this_obj_conv);
66606 }
66607
66608 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
66609         LDKChannelUsage this_ptr_conv;
66610         this_ptr_conv.inner = untag_ptr(this_ptr);
66611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66613         this_ptr_conv.is_owned = false;
66614         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
66615         return ret_conv;
66616 }
66617
66618 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
66619         LDKChannelUsage this_ptr_conv;
66620         this_ptr_conv.inner = untag_ptr(this_ptr);
66621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66623         this_ptr_conv.is_owned = false;
66624         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
66625 }
66626
66627 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
66628         LDKChannelUsage this_ptr_conv;
66629         this_ptr_conv.inner = untag_ptr(this_ptr);
66630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66632         this_ptr_conv.is_owned = false;
66633         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
66634         return ret_conv;
66635 }
66636
66637 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
66638         LDKChannelUsage this_ptr_conv;
66639         this_ptr_conv.inner = untag_ptr(this_ptr);
66640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66642         this_ptr_conv.is_owned = false;
66643         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
66644 }
66645
66646 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
66647         LDKChannelUsage this_ptr_conv;
66648         this_ptr_conv.inner = untag_ptr(this_ptr);
66649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66651         this_ptr_conv.is_owned = false;
66652         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
66653         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
66654         uint64_t ret_ref = tag_ptr(ret_copy, true);
66655         return ret_ref;
66656 }
66657
66658 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
66659         LDKChannelUsage this_ptr_conv;
66660         this_ptr_conv.inner = untag_ptr(this_ptr);
66661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66663         this_ptr_conv.is_owned = false;
66664         void* val_ptr = untag_ptr(val);
66665         CHECK_ACCESS(val_ptr);
66666         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
66667         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
66668         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
66669 }
66670
66671 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) {
66672         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
66673         CHECK_ACCESS(effective_capacity_arg_ptr);
66674         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
66675         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
66676         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
66677         uint64_t ret_ref = 0;
66678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66680         return ret_ref;
66681 }
66682
66683 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
66684         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
66685         uint64_t ret_ref = 0;
66686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66688         return ret_ref;
66689 }
66690 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
66691         LDKChannelUsage arg_conv;
66692         arg_conv.inner = untag_ptr(arg);
66693         arg_conv.is_owned = ptr_is_owned(arg);
66694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66695         arg_conv.is_owned = false;
66696         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
66697         return ret_conv;
66698 }
66699
66700 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
66701         LDKChannelUsage orig_conv;
66702         orig_conv.inner = untag_ptr(orig);
66703         orig_conv.is_owned = ptr_is_owned(orig);
66704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66705         orig_conv.is_owned = false;
66706         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
66707         uint64_t ret_ref = 0;
66708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66710         return ret_ref;
66711 }
66712
66713 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
66714         LDKFixedPenaltyScorer this_obj_conv;
66715         this_obj_conv.inner = untag_ptr(this_obj);
66716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66718         FixedPenaltyScorer_free(this_obj_conv);
66719 }
66720
66721 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
66722         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
66723         uint64_t ret_ref = 0;
66724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66726         return ret_ref;
66727 }
66728 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
66729         LDKFixedPenaltyScorer arg_conv;
66730         arg_conv.inner = untag_ptr(arg);
66731         arg_conv.is_owned = ptr_is_owned(arg);
66732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66733         arg_conv.is_owned = false;
66734         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
66735         return ret_conv;
66736 }
66737
66738 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
66739         LDKFixedPenaltyScorer orig_conv;
66740         orig_conv.inner = untag_ptr(orig);
66741         orig_conv.is_owned = ptr_is_owned(orig);
66742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66743         orig_conv.is_owned = false;
66744         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
66745         uint64_t ret_ref = 0;
66746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66748         return ret_ref;
66749 }
66750
66751 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
66752         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
66753         uint64_t ret_ref = 0;
66754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66756         return ret_ref;
66757 }
66758
66759 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
66760         LDKFixedPenaltyScorer this_arg_conv;
66761         this_arg_conv.inner = untag_ptr(this_arg);
66762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66764         this_arg_conv.is_owned = false;
66765         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66766         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
66767         return tag_ptr(ret_ret, true);
66768 }
66769
66770 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
66771         LDKFixedPenaltyScorer this_arg_conv;
66772         this_arg_conv.inner = untag_ptr(this_arg);
66773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66775         this_arg_conv.is_owned = false;
66776         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66777         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
66778         return tag_ptr(ret_ret, true);
66779 }
66780
66781 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
66782         LDKFixedPenaltyScorer obj_conv;
66783         obj_conv.inner = untag_ptr(obj);
66784         obj_conv.is_owned = ptr_is_owned(obj);
66785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66786         obj_conv.is_owned = false;
66787         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
66788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66790         CVec_u8Z_free(ret_var);
66791         return ret_arr;
66792 }
66793
66794 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
66795         LDKu8slice ser_ref;
66796         ser_ref.datalen = ser->arr_len;
66797         ser_ref.data = ser->elems;
66798         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
66799         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
66800         FREE(ser);
66801         return tag_ptr(ret_conv, true);
66802 }
66803
66804 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
66805         LDKProbabilisticScorer this_obj_conv;
66806         this_obj_conv.inner = untag_ptr(this_obj);
66807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66809         ProbabilisticScorer_free(this_obj_conv);
66810 }
66811
66812 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
66813         LDKProbabilisticScoringFeeParameters this_obj_conv;
66814         this_obj_conv.inner = untag_ptr(this_obj);
66815         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66817         ProbabilisticScoringFeeParameters_free(this_obj_conv);
66818 }
66819
66820 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
66821         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66822         this_ptr_conv.inner = untag_ptr(this_ptr);
66823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66825         this_ptr_conv.is_owned = false;
66826         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
66827         return ret_conv;
66828 }
66829
66830 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
66831         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66832         this_ptr_conv.inner = untag_ptr(this_ptr);
66833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66835         this_ptr_conv.is_owned = false;
66836         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
66837 }
66838
66839 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) {
66840         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66841         this_ptr_conv.inner = untag_ptr(this_ptr);
66842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66844         this_ptr_conv.is_owned = false;
66845         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
66846         return ret_conv;
66847 }
66848
66849 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) {
66850         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66851         this_ptr_conv.inner = untag_ptr(this_ptr);
66852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66854         this_ptr_conv.is_owned = false;
66855         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66856 }
66857
66858 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
66859         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66860         this_ptr_conv.inner = untag_ptr(this_ptr);
66861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66863         this_ptr_conv.is_owned = false;
66864         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66865         return ret_conv;
66866 }
66867
66868 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) {
66869         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66870         this_ptr_conv.inner = untag_ptr(this_ptr);
66871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66873         this_ptr_conv.is_owned = false;
66874         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66875 }
66876
66877 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) {
66878         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66879         this_ptr_conv.inner = untag_ptr(this_ptr);
66880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66882         this_ptr_conv.is_owned = false;
66883         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66884         return ret_conv;
66885 }
66886
66887 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) {
66888         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66889         this_ptr_conv.inner = untag_ptr(this_ptr);
66890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66892         this_ptr_conv.is_owned = false;
66893         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66894 }
66895
66896 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) {
66897         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66898         this_ptr_conv.inner = untag_ptr(this_ptr);
66899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66901         this_ptr_conv.is_owned = false;
66902         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66903         return ret_conv;
66904 }
66905
66906 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) {
66907         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66908         this_ptr_conv.inner = untag_ptr(this_ptr);
66909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66911         this_ptr_conv.is_owned = false;
66912         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66913 }
66914
66915 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) {
66916         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66917         this_ptr_conv.inner = untag_ptr(this_ptr);
66918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66920         this_ptr_conv.is_owned = false;
66921         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66922         return ret_conv;
66923 }
66924
66925 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) {
66926         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66927         this_ptr_conv.inner = untag_ptr(this_ptr);
66928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66930         this_ptr_conv.is_owned = false;
66931         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66932 }
66933
66934 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
66935         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66936         this_ptr_conv.inner = untag_ptr(this_ptr);
66937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66939         this_ptr_conv.is_owned = false;
66940         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
66941         return ret_conv;
66942 }
66943
66944 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) {
66945         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66946         this_ptr_conv.inner = untag_ptr(this_ptr);
66947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66949         this_ptr_conv.is_owned = false;
66950         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
66951 }
66952
66953 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
66954         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66955         this_ptr_conv.inner = untag_ptr(this_ptr);
66956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66958         this_ptr_conv.is_owned = false;
66959         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
66960         return ret_conv;
66961 }
66962
66963 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) {
66964         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66965         this_ptr_conv.inner = untag_ptr(this_ptr);
66966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66968         this_ptr_conv.is_owned = false;
66969         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
66970 }
66971
66972 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
66973         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66974         this_ptr_conv.inner = untag_ptr(this_ptr);
66975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66977         this_ptr_conv.is_owned = false;
66978         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
66979         return ret_conv;
66980 }
66981
66982 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
66983         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66984         this_ptr_conv.inner = untag_ptr(this_ptr);
66985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66987         this_ptr_conv.is_owned = false;
66988         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
66989 }
66990
66991 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
66992         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
66993         uint64_t ret_ref = 0;
66994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66996         return ret_ref;
66997 }
66998 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
66999         LDKProbabilisticScoringFeeParameters arg_conv;
67000         arg_conv.inner = untag_ptr(arg);
67001         arg_conv.is_owned = ptr_is_owned(arg);
67002         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67003         arg_conv.is_owned = false;
67004         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
67005         return ret_conv;
67006 }
67007
67008 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
67009         LDKProbabilisticScoringFeeParameters orig_conv;
67010         orig_conv.inner = untag_ptr(orig);
67011         orig_conv.is_owned = ptr_is_owned(orig);
67012         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67013         orig_conv.is_owned = false;
67014         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
67015         uint64_t ret_ref = 0;
67016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67018         return ret_ref;
67019 }
67020
67021 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
67022         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
67023         uint64_t ret_ref = 0;
67024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67026         return ret_ref;
67027 }
67028
67029 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
67030         LDKProbabilisticScoringFeeParameters this_arg_conv;
67031         this_arg_conv.inner = untag_ptr(this_arg);
67032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67034         this_arg_conv.is_owned = false;
67035         LDKNodeId node_id_conv;
67036         node_id_conv.inner = untag_ptr(node_id);
67037         node_id_conv.is_owned = ptr_is_owned(node_id);
67038         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67039         node_id_conv.is_owned = false;
67040         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
67041 }
67042
67043 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
67044         LDKProbabilisticScoringFeeParameters this_arg_conv;
67045         this_arg_conv.inner = untag_ptr(this_arg);
67046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67048         this_arg_conv.is_owned = false;
67049         LDKCVec_NodeIdZ node_ids_constr;
67050         node_ids_constr.datalen = node_ids->arr_len;
67051         if (node_ids_constr.datalen > 0)
67052                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
67053         else
67054                 node_ids_constr.data = NULL;
67055         uint64_t* node_ids_vals = node_ids->elems;
67056         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
67057                 uint64_t node_ids_conv_8 = node_ids_vals[i];
67058                 LDKNodeId node_ids_conv_8_conv;
67059                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
67060                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
67061                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
67062                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
67063                 node_ids_constr.data[i] = node_ids_conv_8_conv;
67064         }
67065         FREE(node_ids);
67066         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
67067 }
67068
67069 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
67070         LDKProbabilisticScoringFeeParameters this_arg_conv;
67071         this_arg_conv.inner = untag_ptr(this_arg);
67072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67074         this_arg_conv.is_owned = false;
67075         LDKNodeId node_id_conv;
67076         node_id_conv.inner = untag_ptr(node_id);
67077         node_id_conv.is_owned = ptr_is_owned(node_id);
67078         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67079         node_id_conv.is_owned = false;
67080         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
67081 }
67082
67083 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) {
67084         LDKProbabilisticScoringFeeParameters this_arg_conv;
67085         this_arg_conv.inner = untag_ptr(this_arg);
67086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67088         this_arg_conv.is_owned = false;
67089         LDKNodeId node_id_conv;
67090         node_id_conv.inner = untag_ptr(node_id);
67091         node_id_conv.is_owned = ptr_is_owned(node_id);
67092         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67093         node_id_conv.is_owned = false;
67094         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
67095 }
67096
67097 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
67098         LDKProbabilisticScoringFeeParameters this_arg_conv;
67099         this_arg_conv.inner = untag_ptr(this_arg);
67100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67102         this_arg_conv.is_owned = false;
67103         LDKNodeId node_id_conv;
67104         node_id_conv.inner = untag_ptr(node_id);
67105         node_id_conv.is_owned = ptr_is_owned(node_id);
67106         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67107         node_id_conv.is_owned = false;
67108         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
67109 }
67110
67111 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
67112         LDKProbabilisticScoringFeeParameters this_arg_conv;
67113         this_arg_conv.inner = untag_ptr(this_arg);
67114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67116         this_arg_conv.is_owned = false;
67117         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
67118 }
67119
67120 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
67121         LDKProbabilisticScoringDecayParameters this_obj_conv;
67122         this_obj_conv.inner = untag_ptr(this_obj);
67123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67125         ProbabilisticScoringDecayParameters_free(this_obj_conv);
67126 }
67127
67128 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) {
67129         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67130         this_ptr_conv.inner = untag_ptr(this_ptr);
67131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67133         this_ptr_conv.is_owned = false;
67134         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
67135         return ret_conv;
67136 }
67137
67138 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) {
67139         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67140         this_ptr_conv.inner = untag_ptr(this_ptr);
67141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67143         this_ptr_conv.is_owned = false;
67144         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
67145 }
67146
67147 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
67148         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67149         this_ptr_conv.inner = untag_ptr(this_ptr);
67150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67152         this_ptr_conv.is_owned = false;
67153         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
67154         return ret_conv;
67155 }
67156
67157 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) {
67158         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67159         this_ptr_conv.inner = untag_ptr(this_ptr);
67160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67162         this_ptr_conv.is_owned = false;
67163         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
67164 }
67165
67166 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) {
67167         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
67168         uint64_t ret_ref = 0;
67169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67171         return ret_ref;
67172 }
67173
67174 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
67175         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
67176         uint64_t ret_ref = 0;
67177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67179         return ret_ref;
67180 }
67181 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
67182         LDKProbabilisticScoringDecayParameters arg_conv;
67183         arg_conv.inner = untag_ptr(arg);
67184         arg_conv.is_owned = ptr_is_owned(arg);
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67186         arg_conv.is_owned = false;
67187         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
67188         return ret_conv;
67189 }
67190
67191 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
67192         LDKProbabilisticScoringDecayParameters orig_conv;
67193         orig_conv.inner = untag_ptr(orig);
67194         orig_conv.is_owned = ptr_is_owned(orig);
67195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67196         orig_conv.is_owned = false;
67197         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
67198         uint64_t ret_ref = 0;
67199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67201         return ret_ref;
67202 }
67203
67204 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
67205         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
67206         uint64_t ret_ref = 0;
67207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67209         return ret_ref;
67210 }
67211
67212 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
67213         LDKProbabilisticScoringDecayParameters decay_params_conv;
67214         decay_params_conv.inner = untag_ptr(decay_params);
67215         decay_params_conv.is_owned = ptr_is_owned(decay_params);
67216         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
67217         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
67218         LDKNetworkGraph network_graph_conv;
67219         network_graph_conv.inner = untag_ptr(network_graph);
67220         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67221         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67222         network_graph_conv.is_owned = false;
67223         void* logger_ptr = untag_ptr(logger);
67224         CHECK_ACCESS(logger_ptr);
67225         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67226         if (logger_conv.free == LDKLogger_JCalls_free) {
67227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67228                 LDKLogger_JCalls_cloned(&logger_conv);
67229         }
67230         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
67231         uint64_t ret_ref = 0;
67232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67234         return ret_ref;
67235 }
67236
67237 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
67238         LDKProbabilisticScorer this_arg_conv;
67239         this_arg_conv.inner = untag_ptr(this_arg);
67240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67242         this_arg_conv.is_owned = false;
67243         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
67244 }
67245
67246 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) {
67247         LDKProbabilisticScorer this_arg_conv;
67248         this_arg_conv.inner = untag_ptr(this_arg);
67249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67251         this_arg_conv.is_owned = false;
67252         LDKNodeId target_conv;
67253         target_conv.inner = untag_ptr(target);
67254         target_conv.is_owned = ptr_is_owned(target);
67255         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67256         target_conv.is_owned = false;
67257         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
67258         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
67259         uint64_t ret_ref = tag_ptr(ret_copy, true);
67260         return ret_ref;
67261 }
67262
67263 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) {
67264         LDKProbabilisticScorer this_arg_conv;
67265         this_arg_conv.inner = untag_ptr(this_arg);
67266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67268         this_arg_conv.is_owned = false;
67269         LDKNodeId target_conv;
67270         target_conv.inner = untag_ptr(target);
67271         target_conv.is_owned = ptr_is_owned(target);
67272         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67273         target_conv.is_owned = false;
67274         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
67275         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
67276         uint64_t ret_ref = tag_ptr(ret_copy, true);
67277         return ret_ref;
67278 }
67279
67280 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) {
67281         LDKProbabilisticScorer this_arg_conv;
67282         this_arg_conv.inner = untag_ptr(this_arg);
67283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67285         this_arg_conv.is_owned = false;
67286         LDKNodeId target_conv;
67287         target_conv.inner = untag_ptr(target);
67288         target_conv.is_owned = ptr_is_owned(target);
67289         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67290         target_conv.is_owned = false;
67291         LDKProbabilisticScoringFeeParameters params_conv;
67292         params_conv.inner = untag_ptr(params);
67293         params_conv.is_owned = ptr_is_owned(params);
67294         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
67295         params_conv.is_owned = false;
67296         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
67297         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
67298         uint64_t ret_ref = tag_ptr(ret_copy, true);
67299         return ret_ref;
67300 }
67301
67302 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
67303         LDKProbabilisticScorer this_arg_conv;
67304         this_arg_conv.inner = untag_ptr(this_arg);
67305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67307         this_arg_conv.is_owned = false;
67308         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67309         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
67310         return tag_ptr(ret_ret, true);
67311 }
67312
67313 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
67314         LDKProbabilisticScorer this_arg_conv;
67315         this_arg_conv.inner = untag_ptr(this_arg);
67316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67318         this_arg_conv.is_owned = false;
67319         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67320         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
67321         return tag_ptr(ret_ret, true);
67322 }
67323
67324 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
67325         LDKProbabilisticScorer this_arg_conv;
67326         this_arg_conv.inner = untag_ptr(this_arg);
67327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67329         this_arg_conv.is_owned = false;
67330         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
67331         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
67332         return tag_ptr(ret_ret, true);
67333 }
67334
67335 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
67336         LDKProbabilisticScorer obj_conv;
67337         obj_conv.inner = untag_ptr(obj);
67338         obj_conv.is_owned = ptr_is_owned(obj);
67339         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67340         obj_conv.is_owned = false;
67341         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
67342         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67343         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67344         CVec_u8Z_free(ret_var);
67345         return ret_arr;
67346 }
67347
67348 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) {
67349         LDKu8slice ser_ref;
67350         ser_ref.datalen = ser->arr_len;
67351         ser_ref.data = ser->elems;
67352         LDKProbabilisticScoringDecayParameters arg_a_conv;
67353         arg_a_conv.inner = untag_ptr(arg_a);
67354         arg_a_conv.is_owned = ptr_is_owned(arg_a);
67355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
67356         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
67357         LDKNetworkGraph arg_b_conv;
67358         arg_b_conv.inner = untag_ptr(arg_b);
67359         arg_b_conv.is_owned = ptr_is_owned(arg_b);
67360         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
67361         arg_b_conv.is_owned = false;
67362         void* arg_c_ptr = untag_ptr(arg_c);
67363         CHECK_ACCESS(arg_c_ptr);
67364         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
67365         if (arg_c_conv.free == LDKLogger_JCalls_free) {
67366                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67367                 LDKLogger_JCalls_cloned(&arg_c_conv);
67368         }
67369         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
67370         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
67371         FREE(ser);
67372         return tag_ptr(ret_conv, true);
67373 }
67374
67375 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
67376         LDKDelayedPaymentOutputDescriptor this_obj_conv;
67377         this_obj_conv.inner = untag_ptr(this_obj);
67378         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67380         DelayedPaymentOutputDescriptor_free(this_obj_conv);
67381 }
67382
67383 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
67384         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67385         this_ptr_conv.inner = untag_ptr(this_ptr);
67386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67388         this_ptr_conv.is_owned = false;
67389         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67390         uint64_t ret_ref = 0;
67391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67393         return ret_ref;
67394 }
67395
67396 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
67397         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67398         this_ptr_conv.inner = untag_ptr(this_ptr);
67399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67401         this_ptr_conv.is_owned = false;
67402         LDKOutPoint val_conv;
67403         val_conv.inner = untag_ptr(val);
67404         val_conv.is_owned = ptr_is_owned(val);
67405         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67406         val_conv = OutPoint_clone(&val_conv);
67407         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67408 }
67409
67410 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
67411         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67412         this_ptr_conv.inner = untag_ptr(this_ptr);
67413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67415         this_ptr_conv.is_owned = false;
67416         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67417         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
67418         return ret_arr;
67419 }
67420
67421 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
67422         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67423         this_ptr_conv.inner = untag_ptr(this_ptr);
67424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67426         this_ptr_conv.is_owned = false;
67427         LDKPublicKey val_ref;
67428         CHECK(val->arr_len == 33);
67429         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
67430         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
67431 }
67432
67433 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
67434         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67435         this_ptr_conv.inner = untag_ptr(this_ptr);
67436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67438         this_ptr_conv.is_owned = false;
67439         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
67440         return ret_conv;
67441 }
67442
67443 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
67444         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67445         this_ptr_conv.inner = untag_ptr(this_ptr);
67446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67448         this_ptr_conv.is_owned = false;
67449         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
67450 }
67451
67452 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
67453         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67454         this_ptr_conv.inner = untag_ptr(this_ptr);
67455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67457         this_ptr_conv.is_owned = false;
67458         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67459         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
67460         return tag_ptr(ret_ref, true);
67461 }
67462
67463 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
67464         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67465         this_ptr_conv.inner = untag_ptr(this_ptr);
67466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67468         this_ptr_conv.is_owned = false;
67469         void* val_ptr = untag_ptr(val);
67470         CHECK_ACCESS(val_ptr);
67471         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67472         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67473         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67474 }
67475
67476 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
67477         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67478         this_ptr_conv.inner = untag_ptr(this_ptr);
67479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67481         this_ptr_conv.is_owned = false;
67482         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
67483         uint64_t ret_ref = 0;
67484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67486         return ret_ref;
67487 }
67488
67489 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, uint64_t val) {
67490         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67491         this_ptr_conv.inner = untag_ptr(this_ptr);
67492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67494         this_ptr_conv.is_owned = false;
67495         LDKRevocationKey val_conv;
67496         val_conv.inner = untag_ptr(val);
67497         val_conv.is_owned = ptr_is_owned(val);
67498         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67499         val_conv = RevocationKey_clone(&val_conv);
67500         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
67501 }
67502
67503 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
67504         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67505         this_ptr_conv.inner = untag_ptr(this_ptr);
67506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67508         this_ptr_conv.is_owned = false;
67509         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67510         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
67511         return ret_arr;
67512 }
67513
67514 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
67515         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67516         this_ptr_conv.inner = untag_ptr(this_ptr);
67517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67519         this_ptr_conv.is_owned = false;
67520         LDKThirtyTwoBytes val_ref;
67521         CHECK(val->arr_len == 32);
67522         memcpy(val_ref.data, val->elems, 32); FREE(val);
67523         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67524 }
67525
67526 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
67527         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67528         this_ptr_conv.inner = untag_ptr(this_ptr);
67529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67531         this_ptr_conv.is_owned = false;
67532         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67533         return ret_conv;
67534 }
67535
67536 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
67537         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67538         this_ptr_conv.inner = untag_ptr(this_ptr);
67539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67541         this_ptr_conv.is_owned = false;
67542         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67543 }
67544
67545 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, uint64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
67546         LDKOutPoint outpoint_arg_conv;
67547         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67548         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67549         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67550         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67551         LDKPublicKey per_commitment_point_arg_ref;
67552         CHECK(per_commitment_point_arg->arr_len == 33);
67553         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
67554         void* output_arg_ptr = untag_ptr(output_arg);
67555         CHECK_ACCESS(output_arg_ptr);
67556         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67557         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67558         LDKRevocationKey revocation_pubkey_arg_conv;
67559         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
67560         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
67561         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
67562         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
67563         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67564         CHECK(channel_keys_id_arg->arr_len == 32);
67565         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
67566         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
67567         uint64_t ret_ref = 0;
67568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67570         return ret_ref;
67571 }
67572
67573 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
67574         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
67575         uint64_t ret_ref = 0;
67576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67578         return ret_ref;
67579 }
67580 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
67581         LDKDelayedPaymentOutputDescriptor arg_conv;
67582         arg_conv.inner = untag_ptr(arg);
67583         arg_conv.is_owned = ptr_is_owned(arg);
67584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67585         arg_conv.is_owned = false;
67586         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
67587         return ret_conv;
67588 }
67589
67590 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
67591         LDKDelayedPaymentOutputDescriptor orig_conv;
67592         orig_conv.inner = untag_ptr(orig);
67593         orig_conv.is_owned = ptr_is_owned(orig);
67594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67595         orig_conv.is_owned = false;
67596         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
67597         uint64_t ret_ref = 0;
67598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67600         return ret_ref;
67601 }
67602
67603 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
67604         LDKDelayedPaymentOutputDescriptor o_conv;
67605         o_conv.inner = untag_ptr(o);
67606         o_conv.is_owned = ptr_is_owned(o);
67607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67608         o_conv.is_owned = false;
67609         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
67610         return ret_conv;
67611 }
67612
67613 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
67614         LDKDelayedPaymentOutputDescriptor a_conv;
67615         a_conv.inner = untag_ptr(a);
67616         a_conv.is_owned = ptr_is_owned(a);
67617         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67618         a_conv.is_owned = false;
67619         LDKDelayedPaymentOutputDescriptor b_conv;
67620         b_conv.inner = untag_ptr(b);
67621         b_conv.is_owned = ptr_is_owned(b);
67622         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67623         b_conv.is_owned = false;
67624         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67625         return ret_conv;
67626 }
67627
67628 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
67629         LDKDelayedPaymentOutputDescriptor obj_conv;
67630         obj_conv.inner = untag_ptr(obj);
67631         obj_conv.is_owned = ptr_is_owned(obj);
67632         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67633         obj_conv.is_owned = false;
67634         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
67635         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67636         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67637         CVec_u8Z_free(ret_var);
67638         return ret_arr;
67639 }
67640
67641 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
67642         LDKu8slice ser_ref;
67643         ser_ref.datalen = ser->arr_len;
67644         ser_ref.data = ser->elems;
67645         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
67646         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
67647         FREE(ser);
67648         return tag_ptr(ret_conv, true);
67649 }
67650
67651 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
67652         LDKStaticPaymentOutputDescriptor this_obj_conv;
67653         this_obj_conv.inner = untag_ptr(this_obj);
67654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67656         StaticPaymentOutputDescriptor_free(this_obj_conv);
67657 }
67658
67659 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
67660         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67661         this_ptr_conv.inner = untag_ptr(this_ptr);
67662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67664         this_ptr_conv.is_owned = false;
67665         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67666         uint64_t ret_ref = 0;
67667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67669         return ret_ref;
67670 }
67671
67672 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
67673         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67674         this_ptr_conv.inner = untag_ptr(this_ptr);
67675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67677         this_ptr_conv.is_owned = false;
67678         LDKOutPoint val_conv;
67679         val_conv.inner = untag_ptr(val);
67680         val_conv.is_owned = ptr_is_owned(val);
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67682         val_conv = OutPoint_clone(&val_conv);
67683         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67684 }
67685
67686 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
67687         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67688         this_ptr_conv.inner = untag_ptr(this_ptr);
67689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67691         this_ptr_conv.is_owned = false;
67692         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67693         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
67694         return tag_ptr(ret_ref, true);
67695 }
67696
67697 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
67698         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67699         this_ptr_conv.inner = untag_ptr(this_ptr);
67700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67702         this_ptr_conv.is_owned = false;
67703         void* val_ptr = untag_ptr(val);
67704         CHECK_ACCESS(val_ptr);
67705         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67706         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67707         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67708 }
67709
67710 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
67711         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67712         this_ptr_conv.inner = untag_ptr(this_ptr);
67713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67715         this_ptr_conv.is_owned = false;
67716         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67717         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
67718         return ret_arr;
67719 }
67720
67721 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
67722         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67723         this_ptr_conv.inner = untag_ptr(this_ptr);
67724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67726         this_ptr_conv.is_owned = false;
67727         LDKThirtyTwoBytes val_ref;
67728         CHECK(val->arr_len == 32);
67729         memcpy(val_ref.data, val->elems, 32); FREE(val);
67730         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67731 }
67732
67733 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
67734         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67735         this_ptr_conv.inner = untag_ptr(this_ptr);
67736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67738         this_ptr_conv.is_owned = false;
67739         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67740         return ret_conv;
67741 }
67742
67743 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
67744         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67745         this_ptr_conv.inner = untag_ptr(this_ptr);
67746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67748         this_ptr_conv.is_owned = false;
67749         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67750 }
67751
67752 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
67753         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67754         this_ptr_conv.inner = untag_ptr(this_ptr);
67755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67757         this_ptr_conv.is_owned = false;
67758         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
67759         uint64_t ret_ref = 0;
67760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67762         return ret_ref;
67763 }
67764
67765 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
67766         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67767         this_ptr_conv.inner = untag_ptr(this_ptr);
67768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67770         this_ptr_conv.is_owned = false;
67771         LDKChannelTransactionParameters val_conv;
67772         val_conv.inner = untag_ptr(val);
67773         val_conv.is_owned = ptr_is_owned(val);
67774         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67775         val_conv = ChannelTransactionParameters_clone(&val_conv);
67776         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
67777 }
67778
67779 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) {
67780         LDKOutPoint outpoint_arg_conv;
67781         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67782         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67783         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67784         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67785         void* output_arg_ptr = untag_ptr(output_arg);
67786         CHECK_ACCESS(output_arg_ptr);
67787         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67788         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67789         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67790         CHECK(channel_keys_id_arg->arr_len == 32);
67791         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
67792         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
67793         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
67794         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
67795         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
67796         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
67797         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);
67798         uint64_t ret_ref = 0;
67799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67801         return ret_ref;
67802 }
67803
67804 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
67805         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
67806         uint64_t ret_ref = 0;
67807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67809         return ret_ref;
67810 }
67811 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
67812         LDKStaticPaymentOutputDescriptor arg_conv;
67813         arg_conv.inner = untag_ptr(arg);
67814         arg_conv.is_owned = ptr_is_owned(arg);
67815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67816         arg_conv.is_owned = false;
67817         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
67818         return ret_conv;
67819 }
67820
67821 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
67822         LDKStaticPaymentOutputDescriptor orig_conv;
67823         orig_conv.inner = untag_ptr(orig);
67824         orig_conv.is_owned = ptr_is_owned(orig);
67825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67826         orig_conv.is_owned = false;
67827         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
67828         uint64_t ret_ref = 0;
67829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67831         return ret_ref;
67832 }
67833
67834 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
67835         LDKStaticPaymentOutputDescriptor o_conv;
67836         o_conv.inner = untag_ptr(o);
67837         o_conv.is_owned = ptr_is_owned(o);
67838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67839         o_conv.is_owned = false;
67840         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
67841         return ret_conv;
67842 }
67843
67844 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
67845         LDKStaticPaymentOutputDescriptor a_conv;
67846         a_conv.inner = untag_ptr(a);
67847         a_conv.is_owned = ptr_is_owned(a);
67848         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67849         a_conv.is_owned = false;
67850         LDKStaticPaymentOutputDescriptor b_conv;
67851         b_conv.inner = untag_ptr(b);
67852         b_conv.is_owned = ptr_is_owned(b);
67853         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67854         b_conv.is_owned = false;
67855         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67856         return ret_conv;
67857 }
67858
67859 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
67860         LDKStaticPaymentOutputDescriptor this_arg_conv;
67861         this_arg_conv.inner = untag_ptr(this_arg);
67862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67864         this_arg_conv.is_owned = false;
67865         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67866         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
67867         uint64_t ret_ref = tag_ptr(ret_copy, true);
67868         return ret_ref;
67869 }
67870
67871 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
67872         LDKStaticPaymentOutputDescriptor 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         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
67878         return ret_conv;
67879 }
67880
67881 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
67882         LDKStaticPaymentOutputDescriptor obj_conv;
67883         obj_conv.inner = untag_ptr(obj);
67884         obj_conv.is_owned = ptr_is_owned(obj);
67885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67886         obj_conv.is_owned = false;
67887         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
67888         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67889         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67890         CVec_u8Z_free(ret_var);
67891         return ret_arr;
67892 }
67893
67894 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
67895         LDKu8slice ser_ref;
67896         ser_ref.datalen = ser->arr_len;
67897         ser_ref.data = ser->elems;
67898         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
67899         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
67900         FREE(ser);
67901         return tag_ptr(ret_conv, true);
67902 }
67903
67904 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
67905         if (!ptr_is_owned(this_ptr)) return;
67906         void* this_ptr_ptr = untag_ptr(this_ptr);
67907         CHECK_ACCESS(this_ptr_ptr);
67908         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
67909         FREE(untag_ptr(this_ptr));
67910         SpendableOutputDescriptor_free(this_ptr_conv);
67911 }
67912
67913 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
67914         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67915         *ret_copy = SpendableOutputDescriptor_clone(arg);
67916         uint64_t ret_ref = tag_ptr(ret_copy, true);
67917         return ret_ref;
67918 }
67919 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
67920         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
67921         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
67922         return ret_conv;
67923 }
67924
67925 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
67926         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
67927         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67928         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
67929         uint64_t ret_ref = tag_ptr(ret_copy, true);
67930         return ret_ref;
67931 }
67932
67933 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output, int8_tArray channel_keys_id) {
67934         LDKOutPoint outpoint_conv;
67935         outpoint_conv.inner = untag_ptr(outpoint);
67936         outpoint_conv.is_owned = ptr_is_owned(outpoint);
67937         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
67938         outpoint_conv = OutPoint_clone(&outpoint_conv);
67939         void* output_ptr = untag_ptr(output);
67940         CHECK_ACCESS(output_ptr);
67941         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
67942         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
67943         LDKThirtyTwoBytes channel_keys_id_ref;
67944         CHECK(channel_keys_id->arr_len == 32);
67945         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
67946         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67947         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
67948         uint64_t ret_ref = tag_ptr(ret_copy, true);
67949         return ret_ref;
67950 }
67951
67952 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
67953         LDKDelayedPaymentOutputDescriptor a_conv;
67954         a_conv.inner = untag_ptr(a);
67955         a_conv.is_owned = ptr_is_owned(a);
67956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67957         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
67958         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67959         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
67960         uint64_t ret_ref = tag_ptr(ret_copy, true);
67961         return ret_ref;
67962 }
67963
67964 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
67965         LDKStaticPaymentOutputDescriptor a_conv;
67966         a_conv.inner = untag_ptr(a);
67967         a_conv.is_owned = ptr_is_owned(a);
67968         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67969         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
67970         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67971         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
67972         uint64_t ret_ref = tag_ptr(ret_copy, true);
67973         return ret_ref;
67974 }
67975
67976 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
67977         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
67978         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
67979         return ret_conv;
67980 }
67981
67982 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
67983         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
67984         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
67985         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
67986         return ret_conv;
67987 }
67988
67989 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
67990         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
67991         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
67992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67994         CVec_u8Z_free(ret_var);
67995         return ret_arr;
67996 }
67997
67998 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
67999         LDKu8slice ser_ref;
68000         ser_ref.datalen = ser->arr_len;
68001         ser_ref.data = ser->elems;
68002         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
68003         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
68004         FREE(ser);
68005         return tag_ptr(ret_conv, true);
68006 }
68007
68008 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) {
68009         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68010         descriptors_constr.datalen = descriptors->arr_len;
68011         if (descriptors_constr.datalen > 0)
68012                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68013         else
68014                 descriptors_constr.data = NULL;
68015         uint64_t* descriptors_vals = descriptors->elems;
68016         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68017                 uint64_t descriptors_conv_27 = descriptors_vals[b];
68018                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68019                 CHECK_ACCESS(descriptors_conv_27_ptr);
68020                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68021                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68022                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68023         }
68024         FREE(descriptors);
68025         LDKCVec_TxOutZ outputs_constr;
68026         outputs_constr.datalen = outputs->arr_len;
68027         if (outputs_constr.datalen > 0)
68028                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68029         else
68030                 outputs_constr.data = NULL;
68031         uint64_t* outputs_vals = outputs->elems;
68032         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68033                 uint64_t outputs_conv_7 = outputs_vals[h];
68034                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68035                 CHECK_ACCESS(outputs_conv_7_ptr);
68036                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68037                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68038                 outputs_constr.data[h] = outputs_conv_7_conv;
68039         }
68040         FREE(outputs);
68041         LDKCVec_u8Z change_destination_script_ref;
68042         change_destination_script_ref.datalen = change_destination_script->arr_len;
68043         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68044         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
68045         void* locktime_ptr = untag_ptr(locktime);
68046         CHECK_ACCESS(locktime_ptr);
68047         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68048         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68049         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
68050         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68051         return tag_ptr(ret_conv, true);
68052 }
68053
68054 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
68055         LDKChannelDerivationParameters this_obj_conv;
68056         this_obj_conv.inner = untag_ptr(this_obj);
68057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68059         ChannelDerivationParameters_free(this_obj_conv);
68060 }
68061
68062 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
68063         LDKChannelDerivationParameters this_ptr_conv;
68064         this_ptr_conv.inner = untag_ptr(this_ptr);
68065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68067         this_ptr_conv.is_owned = false;
68068         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
68069         return ret_conv;
68070 }
68071
68072 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
68073         LDKChannelDerivationParameters this_ptr_conv;
68074         this_ptr_conv.inner = untag_ptr(this_ptr);
68075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68077         this_ptr_conv.is_owned = false;
68078         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
68079 }
68080
68081 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
68082         LDKChannelDerivationParameters this_ptr_conv;
68083         this_ptr_conv.inner = untag_ptr(this_ptr);
68084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68086         this_ptr_conv.is_owned = false;
68087         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68088         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
68089         return ret_arr;
68090 }
68091
68092 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
68093         LDKChannelDerivationParameters this_ptr_conv;
68094         this_ptr_conv.inner = untag_ptr(this_ptr);
68095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68097         this_ptr_conv.is_owned = false;
68098         LDKThirtyTwoBytes val_ref;
68099         CHECK(val->arr_len == 32);
68100         memcpy(val_ref.data, val->elems, 32); FREE(val);
68101         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
68102 }
68103
68104 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
68105         LDKChannelDerivationParameters this_ptr_conv;
68106         this_ptr_conv.inner = untag_ptr(this_ptr);
68107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68109         this_ptr_conv.is_owned = false;
68110         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
68111         uint64_t ret_ref = 0;
68112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68114         return ret_ref;
68115 }
68116
68117 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
68118         LDKChannelDerivationParameters this_ptr_conv;
68119         this_ptr_conv.inner = untag_ptr(this_ptr);
68120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68122         this_ptr_conv.is_owned = false;
68123         LDKChannelTransactionParameters val_conv;
68124         val_conv.inner = untag_ptr(val);
68125         val_conv.is_owned = ptr_is_owned(val);
68126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68127         val_conv = ChannelTransactionParameters_clone(&val_conv);
68128         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
68129 }
68130
68131 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) {
68132         LDKThirtyTwoBytes keys_id_arg_ref;
68133         CHECK(keys_id_arg->arr_len == 32);
68134         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
68135         LDKChannelTransactionParameters transaction_parameters_arg_conv;
68136         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
68137         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
68138         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
68139         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
68140         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
68141         uint64_t ret_ref = 0;
68142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68144         return ret_ref;
68145 }
68146
68147 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
68148         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
68149         uint64_t ret_ref = 0;
68150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68152         return ret_ref;
68153 }
68154 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
68155         LDKChannelDerivationParameters arg_conv;
68156         arg_conv.inner = untag_ptr(arg);
68157         arg_conv.is_owned = ptr_is_owned(arg);
68158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68159         arg_conv.is_owned = false;
68160         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
68161         return ret_conv;
68162 }
68163
68164 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
68165         LDKChannelDerivationParameters orig_conv;
68166         orig_conv.inner = untag_ptr(orig);
68167         orig_conv.is_owned = ptr_is_owned(orig);
68168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68169         orig_conv.is_owned = false;
68170         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
68171         uint64_t ret_ref = 0;
68172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68174         return ret_ref;
68175 }
68176
68177 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
68178         LDKChannelDerivationParameters a_conv;
68179         a_conv.inner = untag_ptr(a);
68180         a_conv.is_owned = ptr_is_owned(a);
68181         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68182         a_conv.is_owned = false;
68183         LDKChannelDerivationParameters b_conv;
68184         b_conv.inner = untag_ptr(b);
68185         b_conv.is_owned = ptr_is_owned(b);
68186         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68187         b_conv.is_owned = false;
68188         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
68189         return ret_conv;
68190 }
68191
68192 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
68193         LDKChannelDerivationParameters obj_conv;
68194         obj_conv.inner = untag_ptr(obj);
68195         obj_conv.is_owned = ptr_is_owned(obj);
68196         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68197         obj_conv.is_owned = false;
68198         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
68199         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68200         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68201         CVec_u8Z_free(ret_var);
68202         return ret_arr;
68203 }
68204
68205 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
68206         LDKu8slice ser_ref;
68207         ser_ref.datalen = ser->arr_len;
68208         ser_ref.data = ser->elems;
68209         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
68210         *ret_conv = ChannelDerivationParameters_read(ser_ref);
68211         FREE(ser);
68212         return tag_ptr(ret_conv, true);
68213 }
68214
68215 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
68216         LDKHTLCDescriptor this_obj_conv;
68217         this_obj_conv.inner = untag_ptr(this_obj);
68218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68220         HTLCDescriptor_free(this_obj_conv);
68221 }
68222
68223 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
68224         LDKHTLCDescriptor this_ptr_conv;
68225         this_ptr_conv.inner = untag_ptr(this_ptr);
68226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68228         this_ptr_conv.is_owned = false;
68229         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
68230         uint64_t ret_ref = 0;
68231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68233         return ret_ref;
68234 }
68235
68236 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
68237         LDKHTLCDescriptor this_ptr_conv;
68238         this_ptr_conv.inner = untag_ptr(this_ptr);
68239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68241         this_ptr_conv.is_owned = false;
68242         LDKChannelDerivationParameters val_conv;
68243         val_conv.inner = untag_ptr(val);
68244         val_conv.is_owned = ptr_is_owned(val);
68245         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68246         val_conv = ChannelDerivationParameters_clone(&val_conv);
68247         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
68248 }
68249
68250 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
68251         LDKHTLCDescriptor this_ptr_conv;
68252         this_ptr_conv.inner = untag_ptr(this_ptr);
68253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68255         this_ptr_conv.is_owned = false;
68256         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
68257         return ret_conv;
68258 }
68259
68260 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
68261         LDKHTLCDescriptor this_ptr_conv;
68262         this_ptr_conv.inner = untag_ptr(this_ptr);
68263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68265         this_ptr_conv.is_owned = false;
68266         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
68267 }
68268
68269 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
68270         LDKHTLCDescriptor this_ptr_conv;
68271         this_ptr_conv.inner = untag_ptr(this_ptr);
68272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68274         this_ptr_conv.is_owned = false;
68275         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68276         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
68277         return ret_arr;
68278 }
68279
68280 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
68281         LDKHTLCDescriptor this_ptr_conv;
68282         this_ptr_conv.inner = untag_ptr(this_ptr);
68283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68285         this_ptr_conv.is_owned = false;
68286         LDKPublicKey val_ref;
68287         CHECK(val->arr_len == 33);
68288         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68289         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
68290 }
68291
68292 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
68293         LDKHTLCDescriptor this_ptr_conv;
68294         this_ptr_conv.inner = untag_ptr(this_ptr);
68295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68297         this_ptr_conv.is_owned = false;
68298         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
68299         return ret_conv;
68300 }
68301
68302 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
68303         LDKHTLCDescriptor this_ptr_conv;
68304         this_ptr_conv.inner = untag_ptr(this_ptr);
68305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68307         this_ptr_conv.is_owned = false;
68308         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
68309 }
68310
68311 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
68312         LDKHTLCDescriptor this_ptr_conv;
68313         this_ptr_conv.inner = untag_ptr(this_ptr);
68314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68316         this_ptr_conv.is_owned = false;
68317         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
68318         uint64_t ret_ref = 0;
68319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68321         return ret_ref;
68322 }
68323
68324 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
68325         LDKHTLCDescriptor this_ptr_conv;
68326         this_ptr_conv.inner = untag_ptr(this_ptr);
68327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68329         this_ptr_conv.is_owned = false;
68330         LDKHTLCOutputInCommitment val_conv;
68331         val_conv.inner = untag_ptr(val);
68332         val_conv.is_owned = ptr_is_owned(val);
68333         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68334         val_conv = HTLCOutputInCommitment_clone(&val_conv);
68335         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
68336 }
68337
68338 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
68339         LDKHTLCDescriptor this_ptr_conv;
68340         this_ptr_conv.inner = untag_ptr(this_ptr);
68341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68343         this_ptr_conv.is_owned = false;
68344         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
68345         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
68346         uint64_t ret_ref = tag_ptr(ret_copy, true);
68347         return ret_ref;
68348 }
68349
68350 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
68351         LDKHTLCDescriptor this_ptr_conv;
68352         this_ptr_conv.inner = untag_ptr(this_ptr);
68353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68355         this_ptr_conv.is_owned = false;
68356         void* val_ptr = untag_ptr(val);
68357         CHECK_ACCESS(val_ptr);
68358         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
68359         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
68360         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
68361 }
68362
68363 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
68364         LDKHTLCDescriptor this_ptr_conv;
68365         this_ptr_conv.inner = untag_ptr(this_ptr);
68366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68368         this_ptr_conv.is_owned = false;
68369         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
68370         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
68371         return ret_arr;
68372 }
68373
68374 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
68375         LDKHTLCDescriptor this_ptr_conv;
68376         this_ptr_conv.inner = untag_ptr(this_ptr);
68377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68379         this_ptr_conv.is_owned = false;
68380         LDKECDSASignature val_ref;
68381         CHECK(val->arr_len == 64);
68382         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
68383         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
68384 }
68385
68386 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
68387         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
68388         uint64_t ret_ref = 0;
68389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68391         return ret_ref;
68392 }
68393 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
68394         LDKHTLCDescriptor arg_conv;
68395         arg_conv.inner = untag_ptr(arg);
68396         arg_conv.is_owned = ptr_is_owned(arg);
68397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68398         arg_conv.is_owned = false;
68399         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
68400         return ret_conv;
68401 }
68402
68403 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
68404         LDKHTLCDescriptor orig_conv;
68405         orig_conv.inner = untag_ptr(orig);
68406         orig_conv.is_owned = ptr_is_owned(orig);
68407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68408         orig_conv.is_owned = false;
68409         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
68410         uint64_t ret_ref = 0;
68411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68413         return ret_ref;
68414 }
68415
68416 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
68417         LDKHTLCDescriptor 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         LDKHTLCDescriptor 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 = HTLCDescriptor_eq(&a_conv, &b_conv);
68428         return ret_conv;
68429 }
68430
68431 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
68432         LDKHTLCDescriptor obj_conv;
68433         obj_conv.inner = untag_ptr(obj);
68434         obj_conv.is_owned = ptr_is_owned(obj);
68435         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68436         obj_conv.is_owned = false;
68437         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
68438         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68439         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68440         CVec_u8Z_free(ret_var);
68441         return ret_arr;
68442 }
68443
68444 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
68445         LDKu8slice ser_ref;
68446         ser_ref.datalen = ser->arr_len;
68447         ser_ref.data = ser->elems;
68448         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
68449         *ret_conv = HTLCDescriptor_read(ser_ref);
68450         FREE(ser);
68451         return tag_ptr(ret_conv, true);
68452 }
68453
68454 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
68455         LDKHTLCDescriptor this_arg_conv;
68456         this_arg_conv.inner = untag_ptr(this_arg);
68457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68459         this_arg_conv.is_owned = false;
68460         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
68461         uint64_t ret_ref = 0;
68462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68464         return ret_ref;
68465 }
68466
68467 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
68468         LDKHTLCDescriptor this_arg_conv;
68469         this_arg_conv.inner = untag_ptr(this_arg);
68470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68472         this_arg_conv.is_owned = false;
68473         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68474         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
68475         return tag_ptr(ret_ref, true);
68476 }
68477
68478 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
68479         LDKHTLCDescriptor this_arg_conv;
68480         this_arg_conv.inner = untag_ptr(this_arg);
68481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68483         this_arg_conv.is_owned = false;
68484         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
68485         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
68486         return tag_ptr(ret_ref, true);
68487 }
68488
68489 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
68490         LDKHTLCDescriptor this_arg_conv;
68491         this_arg_conv.inner = untag_ptr(this_arg);
68492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68494         this_arg_conv.is_owned = false;
68495         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68496         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
68497         return tag_ptr(ret_ref, true);
68498 }
68499
68500 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
68501         LDKHTLCDescriptor this_arg_conv;
68502         this_arg_conv.inner = untag_ptr(this_arg);
68503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68505         this_arg_conv.is_owned = false;
68506         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
68507         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68508         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68509         CVec_u8Z_free(ret_var);
68510         return ret_arr;
68511 }
68512
68513 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) {
68514         LDKHTLCDescriptor this_arg_conv;
68515         this_arg_conv.inner = untag_ptr(this_arg);
68516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68518         this_arg_conv.is_owned = false;
68519         LDKECDSASignature signature_ref;
68520         CHECK(signature->arr_len == 64);
68521         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
68522         LDKu8slice witness_script_ref;
68523         witness_script_ref.datalen = witness_script->arr_len;
68524         witness_script_ref.data = witness_script->elems;
68525         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
68526         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68527         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68528         Witness_free(ret_var);
68529         FREE(witness_script);
68530         return ret_arr;
68531 }
68532
68533 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
68534         LDKHTLCDescriptor this_arg_conv;
68535         this_arg_conv.inner = untag_ptr(this_arg);
68536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68538         this_arg_conv.is_owned = false;
68539         void* signer_provider_ptr = untag_ptr(signer_provider);
68540         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
68541         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
68542         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68543         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
68544         return tag_ptr(ret_ret, true);
68545 }
68546
68547 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
68548         if (!ptr_is_owned(this_ptr)) return;
68549         void* this_ptr_ptr = untag_ptr(this_ptr);
68550         CHECK_ACCESS(this_ptr_ptr);
68551         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
68552         FREE(untag_ptr(this_ptr));
68553         ChannelSigner_free(this_ptr_conv);
68554 }
68555
68556 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
68557         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
68558         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
68559         return ret_conv;
68560 }
68561
68562 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
68563         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
68564         return ret_conv;
68565 }
68566
68567 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
68568         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
68569         return ret_conv;
68570 }
68571
68572 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
68573         if (!ptr_is_owned(this_ptr)) return;
68574         void* this_ptr_ptr = untag_ptr(this_ptr);
68575         CHECK_ACCESS(this_ptr_ptr);
68576         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
68577         FREE(untag_ptr(this_ptr));
68578         EntropySource_free(this_ptr_conv);
68579 }
68580
68581 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
68582         if (!ptr_is_owned(this_ptr)) return;
68583         void* this_ptr_ptr = untag_ptr(this_ptr);
68584         CHECK_ACCESS(this_ptr_ptr);
68585         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
68586         FREE(untag_ptr(this_ptr));
68587         NodeSigner_free(this_ptr_conv);
68588 }
68589
68590 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
68591         if (!ptr_is_owned(this_ptr)) return;
68592         void* this_ptr_ptr = untag_ptr(this_ptr);
68593         CHECK_ACCESS(this_ptr_ptr);
68594         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
68595         FREE(untag_ptr(this_ptr));
68596         SignerProvider_free(this_ptr_conv);
68597 }
68598
68599 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
68600         LDKInMemorySigner this_obj_conv;
68601         this_obj_conv.inner = untag_ptr(this_obj);
68602         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68604         InMemorySigner_free(this_obj_conv);
68605 }
68606
68607 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
68608         LDKInMemorySigner this_ptr_conv;
68609         this_ptr_conv.inner = untag_ptr(this_ptr);
68610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68612         this_ptr_conv.is_owned = false;
68613         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68614         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
68615         return ret_arr;
68616 }
68617
68618 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
68619         LDKInMemorySigner this_ptr_conv;
68620         this_ptr_conv.inner = untag_ptr(this_ptr);
68621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68623         this_ptr_conv.is_owned = false;
68624         LDKSecretKey val_ref;
68625         CHECK(val->arr_len == 32);
68626         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68627         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
68628 }
68629
68630 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
68631         LDKInMemorySigner this_ptr_conv;
68632         this_ptr_conv.inner = untag_ptr(this_ptr);
68633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68635         this_ptr_conv.is_owned = false;
68636         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68637         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
68638         return ret_arr;
68639 }
68640
68641 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
68642         LDKInMemorySigner this_ptr_conv;
68643         this_ptr_conv.inner = untag_ptr(this_ptr);
68644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68646         this_ptr_conv.is_owned = false;
68647         LDKSecretKey val_ref;
68648         CHECK(val->arr_len == 32);
68649         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68650         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
68651 }
68652
68653 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
68654         LDKInMemorySigner this_ptr_conv;
68655         this_ptr_conv.inner = untag_ptr(this_ptr);
68656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68658         this_ptr_conv.is_owned = false;
68659         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68660         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
68661         return ret_arr;
68662 }
68663
68664 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
68665         LDKInMemorySigner this_ptr_conv;
68666         this_ptr_conv.inner = untag_ptr(this_ptr);
68667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68669         this_ptr_conv.is_owned = false;
68670         LDKSecretKey val_ref;
68671         CHECK(val->arr_len == 32);
68672         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68673         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
68674 }
68675
68676 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
68677         LDKInMemorySigner this_ptr_conv;
68678         this_ptr_conv.inner = untag_ptr(this_ptr);
68679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68681         this_ptr_conv.is_owned = false;
68682         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68683         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
68684         return ret_arr;
68685 }
68686
68687 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) {
68688         LDKInMemorySigner this_ptr_conv;
68689         this_ptr_conv.inner = untag_ptr(this_ptr);
68690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68692         this_ptr_conv.is_owned = false;
68693         LDKSecretKey val_ref;
68694         CHECK(val->arr_len == 32);
68695         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68696         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
68697 }
68698
68699 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
68700         LDKInMemorySigner this_ptr_conv;
68701         this_ptr_conv.inner = untag_ptr(this_ptr);
68702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68704         this_ptr_conv.is_owned = false;
68705         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68706         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
68707         return ret_arr;
68708 }
68709
68710 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
68711         LDKInMemorySigner this_ptr_conv;
68712         this_ptr_conv.inner = untag_ptr(this_ptr);
68713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68715         this_ptr_conv.is_owned = false;
68716         LDKSecretKey val_ref;
68717         CHECK(val->arr_len == 32);
68718         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68719         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
68720 }
68721
68722 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
68723         LDKInMemorySigner this_ptr_conv;
68724         this_ptr_conv.inner = untag_ptr(this_ptr);
68725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68727         this_ptr_conv.is_owned = false;
68728         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68729         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
68730         return ret_arr;
68731 }
68732
68733 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
68734         LDKInMemorySigner this_ptr_conv;
68735         this_ptr_conv.inner = untag_ptr(this_ptr);
68736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68738         this_ptr_conv.is_owned = false;
68739         LDKThirtyTwoBytes val_ref;
68740         CHECK(val->arr_len == 32);
68741         memcpy(val_ref.data, val->elems, 32); FREE(val);
68742         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
68743 }
68744
68745 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
68746         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
68747         uint64_t ret_ref = 0;
68748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68750         return ret_ref;
68751 }
68752 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
68753         LDKInMemorySigner arg_conv;
68754         arg_conv.inner = untag_ptr(arg);
68755         arg_conv.is_owned = ptr_is_owned(arg);
68756         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68757         arg_conv.is_owned = false;
68758         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
68759         return ret_conv;
68760 }
68761
68762 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
68763         LDKInMemorySigner orig_conv;
68764         orig_conv.inner = untag_ptr(orig);
68765         orig_conv.is_owned = ptr_is_owned(orig);
68766         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68767         orig_conv.is_owned = false;
68768         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
68769         uint64_t ret_ref = 0;
68770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68772         return ret_ref;
68773 }
68774
68775 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) {
68776         LDKSecretKey funding_key_ref;
68777         CHECK(funding_key->arr_len == 32);
68778         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
68779         LDKSecretKey revocation_base_key_ref;
68780         CHECK(revocation_base_key->arr_len == 32);
68781         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
68782         LDKSecretKey payment_key_ref;
68783         CHECK(payment_key->arr_len == 32);
68784         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
68785         LDKSecretKey delayed_payment_base_key_ref;
68786         CHECK(delayed_payment_base_key->arr_len == 32);
68787         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
68788         LDKSecretKey htlc_base_key_ref;
68789         CHECK(htlc_base_key->arr_len == 32);
68790         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
68791         LDKThirtyTwoBytes commitment_seed_ref;
68792         CHECK(commitment_seed->arr_len == 32);
68793         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
68794         LDKThirtyTwoBytes channel_keys_id_ref;
68795         CHECK(channel_keys_id->arr_len == 32);
68796         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
68797         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
68798         CHECK(rand_bytes_unique_start->arr_len == 32);
68799         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
68800         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);
68801         uint64_t ret_ref = 0;
68802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68804         return ret_ref;
68805 }
68806
68807 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
68808         LDKInMemorySigner this_arg_conv;
68809         this_arg_conv.inner = untag_ptr(this_arg);
68810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68812         this_arg_conv.is_owned = false;
68813         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
68814         uint64_t ret_ref = 0;
68815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68817         return ret_ref;
68818 }
68819
68820 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
68821         LDKInMemorySigner this_arg_conv;
68822         this_arg_conv.inner = untag_ptr(this_arg);
68823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68825         this_arg_conv.is_owned = false;
68826         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68827         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
68828         uint64_t ret_ref = tag_ptr(ret_copy, true);
68829         return ret_ref;
68830 }
68831
68832 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
68833         LDKInMemorySigner this_arg_conv;
68834         this_arg_conv.inner = untag_ptr(this_arg);
68835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68837         this_arg_conv.is_owned = false;
68838         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68839         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
68840         uint64_t ret_ref = tag_ptr(ret_copy, true);
68841         return ret_ref;
68842 }
68843
68844 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
68845         LDKInMemorySigner this_arg_conv;
68846         this_arg_conv.inner = untag_ptr(this_arg);
68847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68849         this_arg_conv.is_owned = false;
68850         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
68851         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
68852         uint64_t ret_ref = tag_ptr(ret_copy, true);
68853         return ret_ref;
68854 }
68855
68856 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
68857         LDKInMemorySigner this_arg_conv;
68858         this_arg_conv.inner = untag_ptr(this_arg);
68859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68861         this_arg_conv.is_owned = false;
68862         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
68863         uint64_t ret_ref = 0;
68864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68866         return ret_ref;
68867 }
68868
68869 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
68870         LDKInMemorySigner this_arg_conv;
68871         this_arg_conv.inner = untag_ptr(this_arg);
68872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68874         this_arg_conv.is_owned = false;
68875         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
68876         uint64_t ret_ref = 0;
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68879         return ret_ref;
68880 }
68881
68882 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
68883         LDKInMemorySigner this_arg_conv;
68884         this_arg_conv.inner = untag_ptr(this_arg);
68885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68887         this_arg_conv.is_owned = false;
68888         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
68889         uint64_t ret_ref = 0;
68890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68892         return ret_ref;
68893 }
68894
68895 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) {
68896         LDKInMemorySigner this_arg_conv;
68897         this_arg_conv.inner = untag_ptr(this_arg);
68898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68900         this_arg_conv.is_owned = false;
68901         LDKTransaction spend_tx_ref;
68902         spend_tx_ref.datalen = spend_tx->arr_len;
68903         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68904         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
68905         spend_tx_ref.data_is_owned = true;
68906         LDKStaticPaymentOutputDescriptor descriptor_conv;
68907         descriptor_conv.inner = untag_ptr(descriptor);
68908         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68909         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68910         descriptor_conv.is_owned = false;
68911         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
68912         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68913         return tag_ptr(ret_conv, true);
68914 }
68915
68916 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) {
68917         LDKInMemorySigner this_arg_conv;
68918         this_arg_conv.inner = untag_ptr(this_arg);
68919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68921         this_arg_conv.is_owned = false;
68922         LDKTransaction spend_tx_ref;
68923         spend_tx_ref.datalen = spend_tx->arr_len;
68924         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68925         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
68926         spend_tx_ref.data_is_owned = true;
68927         LDKDelayedPaymentOutputDescriptor descriptor_conv;
68928         descriptor_conv.inner = untag_ptr(descriptor);
68929         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68930         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68931         descriptor_conv.is_owned = false;
68932         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
68933         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68934         return tag_ptr(ret_conv, true);
68935 }
68936
68937 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
68938         LDKInMemorySigner this_arg_conv;
68939         this_arg_conv.inner = untag_ptr(this_arg);
68940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68942         this_arg_conv.is_owned = false;
68943         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68944         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
68945         return tag_ptr(ret_ret, true);
68946 }
68947
68948 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
68949         LDKInMemorySigner this_arg_conv;
68950         this_arg_conv.inner = untag_ptr(this_arg);
68951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68953         this_arg_conv.is_owned = false;
68954         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
68955         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
68956         return tag_ptr(ret_ret, true);
68957 }
68958
68959 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
68960         LDKInMemorySigner this_arg_conv;
68961         this_arg_conv.inner = untag_ptr(this_arg);
68962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68964         this_arg_conv.is_owned = false;
68965         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
68966         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
68967         return tag_ptr(ret_ret, true);
68968 }
68969
68970 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
68971         LDKInMemorySigner this_arg_conv;
68972         this_arg_conv.inner = untag_ptr(this_arg);
68973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68975         this_arg_conv.is_owned = false;
68976         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68977         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
68978         return tag_ptr(ret_ret, true);
68979 }
68980
68981 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
68982         LDKInMemorySigner obj_conv;
68983         obj_conv.inner = untag_ptr(obj);
68984         obj_conv.is_owned = ptr_is_owned(obj);
68985         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68986         obj_conv.is_owned = false;
68987         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
68988         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68989         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68990         CVec_u8Z_free(ret_var);
68991         return ret_arr;
68992 }
68993
68994 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
68995         LDKu8slice ser_ref;
68996         ser_ref.datalen = ser->arr_len;
68997         ser_ref.data = ser->elems;
68998         void* arg_ptr = untag_ptr(arg);
68999         CHECK_ACCESS(arg_ptr);
69000         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
69001         if (arg_conv.free == LDKEntropySource_JCalls_free) {
69002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69003                 LDKEntropySource_JCalls_cloned(&arg_conv);
69004         }
69005         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
69006         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
69007         FREE(ser);
69008         return tag_ptr(ret_conv, true);
69009 }
69010
69011 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
69012         LDKKeysManager 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         KeysManager_free(this_obj_conv);
69017 }
69018
69019 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
69020         uint8_t seed_arr[32];
69021         CHECK(seed->arr_len == 32);
69022         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69023         uint8_t (*seed_ref)[32] = &seed_arr;
69024         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
69025         uint64_t ret_ref = 0;
69026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69028         return ret_ref;
69029 }
69030
69031 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
69032         LDKKeysManager this_arg_conv;
69033         this_arg_conv.inner = untag_ptr(this_arg);
69034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69036         this_arg_conv.is_owned = false;
69037         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69038         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69039         return ret_arr;
69040 }
69041
69042 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) {
69043         LDKKeysManager this_arg_conv;
69044         this_arg_conv.inner = untag_ptr(this_arg);
69045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69047         this_arg_conv.is_owned = false;
69048         uint8_t params_arr[32];
69049         CHECK(params->arr_len == 32);
69050         memcpy(params_arr, params->elems, 32); FREE(params);
69051         uint8_t (*params_ref)[32] = &params_arr;
69052         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69053         uint64_t ret_ref = 0;
69054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69056         return ret_ref;
69057 }
69058
69059 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) {
69060         LDKKeysManager this_arg_conv;
69061         this_arg_conv.inner = untag_ptr(this_arg);
69062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69064         this_arg_conv.is_owned = false;
69065         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69066         descriptors_constr.datalen = descriptors->arr_len;
69067         if (descriptors_constr.datalen > 0)
69068                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69069         else
69070                 descriptors_constr.data = NULL;
69071         uint64_t* descriptors_vals = descriptors->elems;
69072         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69073                 uint64_t descriptors_conv_27 = descriptors_vals[b];
69074                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69075                 CHECK_ACCESS(descriptors_conv_27_ptr);
69076                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69077                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69078                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69079         }
69080         FREE(descriptors);
69081         LDKCVec_u8Z psbt_ref;
69082         psbt_ref.datalen = psbt->arr_len;
69083         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
69084         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
69085         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
69086         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
69087         return tag_ptr(ret_conv, true);
69088 }
69089
69090 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) {
69091         LDKKeysManager this_arg_conv;
69092         this_arg_conv.inner = untag_ptr(this_arg);
69093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69095         this_arg_conv.is_owned = false;
69096         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69097         descriptors_constr.datalen = descriptors->arr_len;
69098         if (descriptors_constr.datalen > 0)
69099                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69100         else
69101                 descriptors_constr.data = NULL;
69102         uint64_t* descriptors_vals = descriptors->elems;
69103         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69104                 uint64_t descriptors_conv_27 = descriptors_vals[b];
69105                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69106                 CHECK_ACCESS(descriptors_conv_27_ptr);
69107                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69108                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69109                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69110         }
69111         FREE(descriptors);
69112         LDKCVec_TxOutZ outputs_constr;
69113         outputs_constr.datalen = outputs->arr_len;
69114         if (outputs_constr.datalen > 0)
69115                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69116         else
69117                 outputs_constr.data = NULL;
69118         uint64_t* outputs_vals = outputs->elems;
69119         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69120                 uint64_t outputs_conv_7 = outputs_vals[h];
69121                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69122                 CHECK_ACCESS(outputs_conv_7_ptr);
69123                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69124                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69125                 outputs_constr.data[h] = outputs_conv_7_conv;
69126         }
69127         FREE(outputs);
69128         LDKCVec_u8Z change_destination_script_ref;
69129         change_destination_script_ref.datalen = change_destination_script->arr_len;
69130         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69131         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69132         void* locktime_ptr = untag_ptr(locktime);
69133         CHECK_ACCESS(locktime_ptr);
69134         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69135         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69136         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69137         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69138         return tag_ptr(ret_conv, true);
69139 }
69140
69141 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
69142         LDKKeysManager this_arg_conv;
69143         this_arg_conv.inner = untag_ptr(this_arg);
69144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69146         this_arg_conv.is_owned = false;
69147         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69148         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
69149         return tag_ptr(ret_ret, true);
69150 }
69151
69152 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
69153         LDKKeysManager this_arg_conv;
69154         this_arg_conv.inner = untag_ptr(this_arg);
69155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69157         this_arg_conv.is_owned = false;
69158         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69159         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
69160         return tag_ptr(ret_ret, true);
69161 }
69162
69163 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
69164         LDKKeysManager this_arg_conv;
69165         this_arg_conv.inner = untag_ptr(this_arg);
69166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69168         this_arg_conv.is_owned = false;
69169         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69170         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
69171         return tag_ptr(ret_ret, true);
69172 }
69173
69174 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
69175         LDKPhantomKeysManager this_obj_conv;
69176         this_obj_conv.inner = untag_ptr(this_obj);
69177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69179         PhantomKeysManager_free(this_obj_conv);
69180 }
69181
69182 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
69183         LDKPhantomKeysManager this_arg_conv;
69184         this_arg_conv.inner = untag_ptr(this_arg);
69185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69187         this_arg_conv.is_owned = false;
69188         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69189         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
69190         return tag_ptr(ret_ret, true);
69191 }
69192
69193 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
69194         LDKPhantomKeysManager this_arg_conv;
69195         this_arg_conv.inner = untag_ptr(this_arg);
69196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69198         this_arg_conv.is_owned = false;
69199         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69200         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
69201         return tag_ptr(ret_ret, true);
69202 }
69203
69204 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
69205         LDKPhantomKeysManager this_arg_conv;
69206         this_arg_conv.inner = untag_ptr(this_arg);
69207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69209         this_arg_conv.is_owned = false;
69210         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69211         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
69212         return tag_ptr(ret_ret, true);
69213 }
69214
69215 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) {
69216         uint8_t seed_arr[32];
69217         CHECK(seed->arr_len == 32);
69218         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69219         uint8_t (*seed_ref)[32] = &seed_arr;
69220         uint8_t cross_node_seed_arr[32];
69221         CHECK(cross_node_seed->arr_len == 32);
69222         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
69223         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
69224         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
69225         uint64_t ret_ref = 0;
69226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69228         return ret_ref;
69229 }
69230
69231 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) {
69232         LDKPhantomKeysManager this_arg_conv;
69233         this_arg_conv.inner = untag_ptr(this_arg);
69234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69236         this_arg_conv.is_owned = false;
69237         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69238         descriptors_constr.datalen = descriptors->arr_len;
69239         if (descriptors_constr.datalen > 0)
69240                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69241         else
69242                 descriptors_constr.data = NULL;
69243         uint64_t* descriptors_vals = descriptors->elems;
69244         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69245                 uint64_t descriptors_conv_27 = descriptors_vals[b];
69246                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69247                 CHECK_ACCESS(descriptors_conv_27_ptr);
69248                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69249                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69250                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69251         }
69252         FREE(descriptors);
69253         LDKCVec_TxOutZ outputs_constr;
69254         outputs_constr.datalen = outputs->arr_len;
69255         if (outputs_constr.datalen > 0)
69256                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69257         else
69258                 outputs_constr.data = NULL;
69259         uint64_t* outputs_vals = outputs->elems;
69260         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69261                 uint64_t outputs_conv_7 = outputs_vals[h];
69262                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69263                 CHECK_ACCESS(outputs_conv_7_ptr);
69264                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69265                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69266                 outputs_constr.data[h] = outputs_conv_7_conv;
69267         }
69268         FREE(outputs);
69269         LDKCVec_u8Z change_destination_script_ref;
69270         change_destination_script_ref.datalen = change_destination_script->arr_len;
69271         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69272         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69273         void* locktime_ptr = untag_ptr(locktime);
69274         CHECK_ACCESS(locktime_ptr);
69275         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69276         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69277         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69278         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69279         return tag_ptr(ret_conv, true);
69280 }
69281
69282 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) {
69283         LDKPhantomKeysManager this_arg_conv;
69284         this_arg_conv.inner = untag_ptr(this_arg);
69285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69287         this_arg_conv.is_owned = false;
69288         uint8_t params_arr[32];
69289         CHECK(params->arr_len == 32);
69290         memcpy(params_arr, params->elems, 32); FREE(params);
69291         uint8_t (*params_ref)[32] = &params_arr;
69292         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69293         uint64_t ret_ref = 0;
69294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69296         return ret_ref;
69297 }
69298
69299 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
69300         LDKPhantomKeysManager this_arg_conv;
69301         this_arg_conv.inner = untag_ptr(this_arg);
69302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69304         this_arg_conv.is_owned = false;
69305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69306         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69307         return ret_arr;
69308 }
69309
69310 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
69311         LDKPhantomKeysManager this_arg_conv;
69312         this_arg_conv.inner = untag_ptr(this_arg);
69313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69315         this_arg_conv.is_owned = false;
69316         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69317         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
69318         return ret_arr;
69319 }
69320
69321 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
69322         if (!ptr_is_owned(this_ptr)) return;
69323         void* this_ptr_ptr = untag_ptr(this_ptr);
69324         CHECK_ACCESS(this_ptr_ptr);
69325         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
69326         FREE(untag_ptr(this_ptr));
69327         EcdsaChannelSigner_free(this_ptr_conv);
69328 }
69329
69330 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
69331         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69332         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
69333         return tag_ptr(ret_ret, true);
69334 }
69335 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
69336         void* arg_ptr = untag_ptr(arg);
69337         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69338         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
69339         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
69340         return ret_conv;
69341 }
69342
69343 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
69344         void* orig_ptr = untag_ptr(orig);
69345         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69346         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
69347         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69348         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
69349         return tag_ptr(ret_ret, true);
69350 }
69351
69352 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
69353         if (!ptr_is_owned(this_ptr)) return;
69354         void* this_ptr_ptr = untag_ptr(this_ptr);
69355         CHECK_ACCESS(this_ptr_ptr);
69356         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
69357         FREE(untag_ptr(this_ptr));
69358         WriteableEcdsaChannelSigner_free(this_ptr_conv);
69359 }
69360
69361 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
69362         LDKOnionMessenger this_obj_conv;
69363         this_obj_conv.inner = untag_ptr(this_obj);
69364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69366         OnionMessenger_free(this_obj_conv);
69367 }
69368
69369 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
69370         if (!ptr_is_owned(this_ptr)) return;
69371         void* this_ptr_ptr = untag_ptr(this_ptr);
69372         CHECK_ACCESS(this_ptr_ptr);
69373         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
69374         FREE(untag_ptr(this_ptr));
69375         MessageRouter_free(this_ptr_conv);
69376 }
69377
69378 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
69379         LDKDefaultMessageRouter this_obj_conv;
69380         this_obj_conv.inner = untag_ptr(this_obj);
69381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69383         DefaultMessageRouter_free(this_obj_conv);
69384 }
69385
69386 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new(uint64_t network_graph, uint64_t entropy_source) {
69387         LDKNetworkGraph network_graph_conv;
69388         network_graph_conv.inner = untag_ptr(network_graph);
69389         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69390         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69391         network_graph_conv.is_owned = false;
69392         void* entropy_source_ptr = untag_ptr(entropy_source);
69393         CHECK_ACCESS(entropy_source_ptr);
69394         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69395         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69397                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69398         }
69399         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
69400         uint64_t ret_ref = 0;
69401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69403         return ret_ref;
69404 }
69405
69406 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
69407         LDKDefaultMessageRouter this_arg_conv;
69408         this_arg_conv.inner = untag_ptr(this_arg);
69409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69411         this_arg_conv.is_owned = false;
69412         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69413         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
69414         return tag_ptr(ret_ret, true);
69415 }
69416
69417 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
69418         LDKOnionMessagePath this_obj_conv;
69419         this_obj_conv.inner = untag_ptr(this_obj);
69420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69422         OnionMessagePath_free(this_obj_conv);
69423 }
69424
69425 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
69426         LDKOnionMessagePath this_ptr_conv;
69427         this_ptr_conv.inner = untag_ptr(this_ptr);
69428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69430         this_ptr_conv.is_owned = false;
69431         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
69432         ptrArray ret_arr = NULL;
69433         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69434         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
69435         for (size_t m = 0; m < ret_var.datalen; m++) {
69436                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
69437                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
69438                 ret_arr_ptr[m] = ret_conv_12_arr;
69439         }
69440         
69441         FREE(ret_var.data);
69442         return ret_arr;
69443 }
69444
69445 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
69446         LDKOnionMessagePath this_ptr_conv;
69447         this_ptr_conv.inner = untag_ptr(this_ptr);
69448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69450         this_ptr_conv.is_owned = false;
69451         LDKCVec_PublicKeyZ val_constr;
69452         val_constr.datalen = val->arr_len;
69453         if (val_constr.datalen > 0)
69454                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69455         else
69456                 val_constr.data = NULL;
69457         int8_tArray* val_vals = (void*) val->elems;
69458         for (size_t m = 0; m < val_constr.datalen; m++) {
69459                 int8_tArray val_conv_12 = val_vals[m];
69460                 LDKPublicKey val_conv_12_ref;
69461                 CHECK(val_conv_12->arr_len == 33);
69462                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
69463                 val_constr.data[m] = val_conv_12_ref;
69464         }
69465         FREE(val);
69466         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
69467 }
69468
69469 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
69470         LDKOnionMessagePath this_ptr_conv;
69471         this_ptr_conv.inner = untag_ptr(this_ptr);
69472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69474         this_ptr_conv.is_owned = false;
69475         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69476         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
69477         uint64_t ret_ref = tag_ptr(ret_copy, true);
69478         return ret_ref;
69479 }
69480
69481 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
69482         LDKOnionMessagePath this_ptr_conv;
69483         this_ptr_conv.inner = untag_ptr(this_ptr);
69484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69486         this_ptr_conv.is_owned = false;
69487         void* val_ptr = untag_ptr(val);
69488         CHECK_ACCESS(val_ptr);
69489         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
69490         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
69491         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
69492 }
69493
69494 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_first_node_addresses"))) TS_OnionMessagePath_get_first_node_addresses(uint64_t this_ptr) {
69495         LDKOnionMessagePath this_ptr_conv;
69496         this_ptr_conv.inner = untag_ptr(this_ptr);
69497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69499         this_ptr_conv.is_owned = false;
69500         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69501         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
69502         uint64_t ret_ref = tag_ptr(ret_copy, true);
69503         return ret_ref;
69504 }
69505
69506 void  __attribute__((export_name("TS_OnionMessagePath_set_first_node_addresses"))) TS_OnionMessagePath_set_first_node_addresses(uint64_t this_ptr, uint64_t val) {
69507         LDKOnionMessagePath this_ptr_conv;
69508         this_ptr_conv.inner = untag_ptr(this_ptr);
69509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69511         this_ptr_conv.is_owned = false;
69512         void* val_ptr = untag_ptr(val);
69513         CHECK_ACCESS(val_ptr);
69514         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
69515         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
69516         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
69517 }
69518
69519 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg, uint64_t first_node_addresses_arg) {
69520         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
69521         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
69522         if (intermediate_nodes_arg_constr.datalen > 0)
69523                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69524         else
69525                 intermediate_nodes_arg_constr.data = NULL;
69526         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
69527         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
69528                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
69529                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
69530                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
69531                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
69532                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
69533         }
69534         FREE(intermediate_nodes_arg);
69535         void* destination_arg_ptr = untag_ptr(destination_arg);
69536         CHECK_ACCESS(destination_arg_ptr);
69537         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
69538         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
69539         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
69540         CHECK_ACCESS(first_node_addresses_arg_ptr);
69541         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
69542         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
69543         uint64_t ret_ref = 0;
69544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69546         return ret_ref;
69547 }
69548
69549 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
69550         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
69551         uint64_t ret_ref = 0;
69552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69554         return ret_ref;
69555 }
69556 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
69557         LDKOnionMessagePath arg_conv;
69558         arg_conv.inner = untag_ptr(arg);
69559         arg_conv.is_owned = ptr_is_owned(arg);
69560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69561         arg_conv.is_owned = false;
69562         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
69563         return ret_conv;
69564 }
69565
69566 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
69567         LDKOnionMessagePath orig_conv;
69568         orig_conv.inner = untag_ptr(orig);
69569         orig_conv.is_owned = ptr_is_owned(orig);
69570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69571         orig_conv.is_owned = false;
69572         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
69573         uint64_t ret_ref = 0;
69574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69576         return ret_ref;
69577 }
69578
69579 int8_tArray  __attribute__((export_name("TS_OnionMessagePath_first_node"))) TS_OnionMessagePath_first_node(uint64_t this_arg) {
69580         LDKOnionMessagePath this_arg_conv;
69581         this_arg_conv.inner = untag_ptr(this_arg);
69582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69584         this_arg_conv.is_owned = false;
69585         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69586         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
69587         return ret_arr;
69588 }
69589
69590 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
69591         if (!ptr_is_owned(this_ptr)) return;
69592         void* this_ptr_ptr = untag_ptr(this_ptr);
69593         CHECK_ACCESS(this_ptr_ptr);
69594         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
69595         FREE(untag_ptr(this_ptr));
69596         Destination_free(this_ptr_conv);
69597 }
69598
69599 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
69600         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69601         *ret_copy = Destination_clone(arg);
69602         uint64_t ret_ref = tag_ptr(ret_copy, true);
69603         return ret_ref;
69604 }
69605 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
69606         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
69607         int64_t ret_conv = Destination_clone_ptr(arg_conv);
69608         return ret_conv;
69609 }
69610
69611 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
69612         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
69613         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69614         *ret_copy = Destination_clone(orig_conv);
69615         uint64_t ret_ref = tag_ptr(ret_copy, true);
69616         return ret_ref;
69617 }
69618
69619 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
69620         LDKPublicKey a_ref;
69621         CHECK(a->arr_len == 33);
69622         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69623         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69624         *ret_copy = Destination_node(a_ref);
69625         uint64_t ret_ref = tag_ptr(ret_copy, true);
69626         return ret_ref;
69627 }
69628
69629 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
69630         LDKBlindedPath a_conv;
69631         a_conv.inner = untag_ptr(a);
69632         a_conv.is_owned = ptr_is_owned(a);
69633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69634         a_conv = BlindedPath_clone(&a_conv);
69635         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69636         *ret_copy = Destination_blinded_path(a_conv);
69637         uint64_t ret_ref = tag_ptr(ret_copy, true);
69638         return ret_ref;
69639 }
69640
69641 void  __attribute__((export_name("TS_SendSuccess_free"))) TS_SendSuccess_free(uint64_t this_ptr) {
69642         if (!ptr_is_owned(this_ptr)) return;
69643         void* this_ptr_ptr = untag_ptr(this_ptr);
69644         CHECK_ACCESS(this_ptr_ptr);
69645         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
69646         FREE(untag_ptr(this_ptr));
69647         SendSuccess_free(this_ptr_conv);
69648 }
69649
69650 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
69651         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69652         *ret_copy = SendSuccess_clone(arg);
69653         uint64_t ret_ref = tag_ptr(ret_copy, true);
69654         return ret_ref;
69655 }
69656 int64_t  __attribute__((export_name("TS_SendSuccess_clone_ptr"))) TS_SendSuccess_clone_ptr(uint64_t arg) {
69657         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
69658         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
69659         return ret_conv;
69660 }
69661
69662 uint64_t  __attribute__((export_name("TS_SendSuccess_clone"))) TS_SendSuccess_clone(uint64_t orig) {
69663         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
69664         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69665         *ret_copy = SendSuccess_clone(orig_conv);
69666         uint64_t ret_ref = tag_ptr(ret_copy, true);
69667         return ret_ref;
69668 }
69669
69670 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered"))) TS_SendSuccess_buffered() {
69671         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69672         *ret_copy = SendSuccess_buffered();
69673         uint64_t ret_ref = tag_ptr(ret_copy, true);
69674         return ret_ref;
69675 }
69676
69677 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered_awaiting_connection"))) TS_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
69678         LDKPublicKey a_ref;
69679         CHECK(a->arr_len == 33);
69680         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69681         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69682         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
69683         uint64_t ret_ref = tag_ptr(ret_copy, true);
69684         return ret_ref;
69685 }
69686
69687 jboolean  __attribute__((export_name("TS_SendSuccess_eq"))) TS_SendSuccess_eq(uint64_t a, uint64_t b) {
69688         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
69689         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
69690         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
69691         return ret_conv;
69692 }
69693
69694 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
69695         if (!ptr_is_owned(this_ptr)) return;
69696         void* this_ptr_ptr = untag_ptr(this_ptr);
69697         CHECK_ACCESS(this_ptr_ptr);
69698         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
69699         FREE(untag_ptr(this_ptr));
69700         SendError_free(this_ptr_conv);
69701 }
69702
69703 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
69704         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69705         *ret_copy = SendError_clone(arg);
69706         uint64_t ret_ref = tag_ptr(ret_copy, true);
69707         return ret_ref;
69708 }
69709 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
69710         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
69711         int64_t ret_conv = SendError_clone_ptr(arg_conv);
69712         return ret_conv;
69713 }
69714
69715 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
69716         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
69717         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69718         *ret_copy = SendError_clone(orig_conv);
69719         uint64_t ret_ref = tag_ptr(ret_copy, true);
69720         return ret_ref;
69721 }
69722
69723 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
69724         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
69725         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69726         *ret_copy = SendError_secp256k1(a_conv);
69727         uint64_t ret_ref = tag_ptr(ret_copy, true);
69728         return ret_ref;
69729 }
69730
69731 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
69732         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69733         *ret_copy = SendError_too_big_packet();
69734         uint64_t ret_ref = tag_ptr(ret_copy, true);
69735         return ret_ref;
69736 }
69737
69738 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
69739         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69740         *ret_copy = SendError_too_few_blinded_hops();
69741         uint64_t ret_ref = tag_ptr(ret_copy, true);
69742         return ret_ref;
69743 }
69744
69745 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop(int8_tArray a) {
69746         LDKPublicKey a_ref;
69747         CHECK(a->arr_len == 33);
69748         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69749         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69750         *ret_copy = SendError_invalid_first_hop(a_ref);
69751         uint64_t ret_ref = tag_ptr(ret_copy, true);
69752         return ret_ref;
69753 }
69754
69755 uint64_t  __attribute__((export_name("TS_SendError_path_not_found"))) TS_SendError_path_not_found() {
69756         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69757         *ret_copy = SendError_path_not_found();
69758         uint64_t ret_ref = tag_ptr(ret_copy, true);
69759         return ret_ref;
69760 }
69761
69762 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
69763         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69764         *ret_copy = SendError_invalid_message();
69765         uint64_t ret_ref = tag_ptr(ret_copy, true);
69766         return ret_ref;
69767 }
69768
69769 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
69770         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69771         *ret_copy = SendError_buffer_full();
69772         uint64_t ret_ref = tag_ptr(ret_copy, true);
69773         return ret_ref;
69774 }
69775
69776 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
69777         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69778         *ret_copy = SendError_get_node_id_failed();
69779         uint64_t ret_ref = tag_ptr(ret_copy, true);
69780         return ret_ref;
69781 }
69782
69783 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
69784         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69785         *ret_copy = SendError_blinded_path_advance_failed();
69786         uint64_t ret_ref = tag_ptr(ret_copy, true);
69787         return ret_ref;
69788 }
69789
69790 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
69791         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
69792         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
69793         jboolean ret_conv = SendError_eq(a_conv, b_conv);
69794         return ret_conv;
69795 }
69796
69797 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
69798         if (!ptr_is_owned(this_ptr)) return;
69799         void* this_ptr_ptr = untag_ptr(this_ptr);
69800         CHECK_ACCESS(this_ptr_ptr);
69801         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
69802         FREE(untag_ptr(this_ptr));
69803         CustomOnionMessageHandler_free(this_ptr_conv);
69804 }
69805
69806 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
69807         if (!ptr_is_owned(this_ptr)) return;
69808         void* this_ptr_ptr = untag_ptr(this_ptr);
69809         CHECK_ACCESS(this_ptr_ptr);
69810         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
69811         FREE(untag_ptr(this_ptr));
69812         PeeledOnion_free(this_ptr_conv);
69813 }
69814
69815 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
69816         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69817         *ret_copy = PeeledOnion_clone(arg);
69818         uint64_t ret_ref = tag_ptr(ret_copy, true);
69819         return ret_ref;
69820 }
69821 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
69822         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
69823         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
69824         return ret_conv;
69825 }
69826
69827 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
69828         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
69829         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69830         *ret_copy = PeeledOnion_clone(orig_conv);
69831         uint64_t ret_ref = tag_ptr(ret_copy, true);
69832         return ret_ref;
69833 }
69834
69835 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(int8_tArray a, uint64_t b) {
69836         LDKPublicKey a_ref;
69837         CHECK(a->arr_len == 33);
69838         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69839         LDKOnionMessage b_conv;
69840         b_conv.inner = untag_ptr(b);
69841         b_conv.is_owned = ptr_is_owned(b);
69842         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69843         b_conv = OnionMessage_clone(&b_conv);
69844         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69845         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
69846         uint64_t ret_ref = tag_ptr(ret_copy, true);
69847         return ret_ref;
69848 }
69849
69850 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
69851         void* a_ptr = untag_ptr(a);
69852         CHECK_ACCESS(a_ptr);
69853         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
69854         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
69855         LDKThirtyTwoBytes b_ref;
69856         CHECK(b->arr_len == 32);
69857         memcpy(b_ref.data, b->elems, 32); FREE(b);
69858         LDKBlindedPath c_conv;
69859         c_conv.inner = untag_ptr(c);
69860         c_conv.is_owned = ptr_is_owned(c);
69861         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
69862         c_conv = BlindedPath_clone(&c_conv);
69863         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69864         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
69865         uint64_t ret_ref = tag_ptr(ret_copy, true);
69866         return ret_ref;
69867 }
69868
69869 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) {
69870         void* entropy_source_ptr = untag_ptr(entropy_source);
69871         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
69872         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
69873         void* node_signer_ptr = untag_ptr(node_signer);
69874         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
69875         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
69876         LDKOnionMessagePath path_conv;
69877         path_conv.inner = untag_ptr(path);
69878         path_conv.is_owned = ptr_is_owned(path);
69879         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69880         path_conv = OnionMessagePath_clone(&path_conv);
69881         void* contents_ptr = untag_ptr(contents);
69882         CHECK_ACCESS(contents_ptr);
69883         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69884         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69886                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69887         }
69888         LDKBlindedPath reply_path_conv;
69889         reply_path_conv.inner = untag_ptr(reply_path);
69890         reply_path_conv.is_owned = ptr_is_owned(reply_path);
69891         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
69892         reply_path_conv = BlindedPath_clone(&reply_path_conv);
69893         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
69894         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
69895         return tag_ptr(ret_conv, true);
69896 }
69897
69898 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) {
69899         LDKOnionMessage msg_conv;
69900         msg_conv.inner = untag_ptr(msg);
69901         msg_conv.is_owned = ptr_is_owned(msg);
69902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69903         msg_conv.is_owned = false;
69904         void* node_signer_ptr = untag_ptr(node_signer);
69905         CHECK_ACCESS(node_signer_ptr);
69906         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69907         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69908                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69909                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69910         }
69911         void* logger_ptr = untag_ptr(logger);
69912         CHECK_ACCESS(logger_ptr);
69913         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69914         if (logger_conv.free == LDKLogger_JCalls_free) {
69915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69916                 LDKLogger_JCalls_cloned(&logger_conv);
69917         }
69918         void* custom_handler_ptr = untag_ptr(custom_handler);
69919         CHECK_ACCESS(custom_handler_ptr);
69920         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69921         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69922                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69923                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69924         }
69925         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
69926         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
69927         return tag_ptr(ret_conv, true);
69928 }
69929
69930 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) {
69931         void* entropy_source_ptr = untag_ptr(entropy_source);
69932         CHECK_ACCESS(entropy_source_ptr);
69933         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69934         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69936                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69937         }
69938         void* node_signer_ptr = untag_ptr(node_signer);
69939         CHECK_ACCESS(node_signer_ptr);
69940         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69941         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69942                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69943                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69944         }
69945         void* logger_ptr = untag_ptr(logger);
69946         CHECK_ACCESS(logger_ptr);
69947         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69948         if (logger_conv.free == LDKLogger_JCalls_free) {
69949                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69950                 LDKLogger_JCalls_cloned(&logger_conv);
69951         }
69952         void* message_router_ptr = untag_ptr(message_router);
69953         CHECK_ACCESS(message_router_ptr);
69954         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
69955         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
69956                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69957                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
69958         }
69959         void* offers_handler_ptr = untag_ptr(offers_handler);
69960         CHECK_ACCESS(offers_handler_ptr);
69961         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
69962         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
69963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69964                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
69965         }
69966         void* custom_handler_ptr = untag_ptr(custom_handler);
69967         CHECK_ACCESS(custom_handler_ptr);
69968         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69969         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69970                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69971                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69972         }
69973         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
69974         uint64_t ret_ref = 0;
69975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69977         return ret_ref;
69978 }
69979
69980 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, uint64_t contents, uint64_t destination, uint64_t reply_path) {
69981         LDKOnionMessenger this_arg_conv;
69982         this_arg_conv.inner = untag_ptr(this_arg);
69983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69985         this_arg_conv.is_owned = false;
69986         void* contents_ptr = untag_ptr(contents);
69987         CHECK_ACCESS(contents_ptr);
69988         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69989         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69990                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69991                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69992         }
69993         void* destination_ptr = untag_ptr(destination);
69994         CHECK_ACCESS(destination_ptr);
69995         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
69996         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
69997         LDKBlindedPath reply_path_conv;
69998         reply_path_conv.inner = untag_ptr(reply_path);
69999         reply_path_conv.is_owned = ptr_is_owned(reply_path);
70000         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
70001         reply_path_conv = BlindedPath_clone(&reply_path_conv);
70002         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
70003         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
70004         return tag_ptr(ret_conv, true);
70005 }
70006
70007 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
70008         LDKOnionMessenger this_arg_conv;
70009         this_arg_conv.inner = untag_ptr(this_arg);
70010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70012         this_arg_conv.is_owned = false;
70013         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
70014         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
70015         return tag_ptr(ret_ret, true);
70016 }
70017
70018 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
70019         if (!ptr_is_owned(this_ptr)) return;
70020         void* this_ptr_ptr = untag_ptr(this_ptr);
70021         CHECK_ACCESS(this_ptr_ptr);
70022         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
70023         FREE(untag_ptr(this_ptr));
70024         OffersMessageHandler_free(this_ptr_conv);
70025 }
70026
70027 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
70028         if (!ptr_is_owned(this_ptr)) return;
70029         void* this_ptr_ptr = untag_ptr(this_ptr);
70030         CHECK_ACCESS(this_ptr_ptr);
70031         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
70032         FREE(untag_ptr(this_ptr));
70033         OffersMessage_free(this_ptr_conv);
70034 }
70035
70036 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
70037         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70038         *ret_copy = OffersMessage_clone(arg);
70039         uint64_t ret_ref = tag_ptr(ret_copy, true);
70040         return ret_ref;
70041 }
70042 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
70043         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
70044         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
70045         return ret_conv;
70046 }
70047
70048 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
70049         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
70050         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70051         *ret_copy = OffersMessage_clone(orig_conv);
70052         uint64_t ret_ref = tag_ptr(ret_copy, true);
70053         return ret_ref;
70054 }
70055
70056 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
70057         LDKInvoiceRequest a_conv;
70058         a_conv.inner = untag_ptr(a);
70059         a_conv.is_owned = ptr_is_owned(a);
70060         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70061         a_conv = InvoiceRequest_clone(&a_conv);
70062         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70063         *ret_copy = OffersMessage_invoice_request(a_conv);
70064         uint64_t ret_ref = tag_ptr(ret_copy, true);
70065         return ret_ref;
70066 }
70067
70068 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
70069         LDKBolt12Invoice a_conv;
70070         a_conv.inner = untag_ptr(a);
70071         a_conv.is_owned = ptr_is_owned(a);
70072         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70073         a_conv = Bolt12Invoice_clone(&a_conv);
70074         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70075         *ret_copy = OffersMessage_invoice(a_conv);
70076         uint64_t ret_ref = tag_ptr(ret_copy, true);
70077         return ret_ref;
70078 }
70079
70080 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
70081         LDKInvoiceError a_conv;
70082         a_conv.inner = untag_ptr(a);
70083         a_conv.is_owned = ptr_is_owned(a);
70084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70085         a_conv = InvoiceError_clone(&a_conv);
70086         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70087         *ret_copy = OffersMessage_invoice_error(a_conv);
70088         uint64_t ret_ref = tag_ptr(ret_copy, true);
70089         return ret_ref;
70090 }
70091
70092 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
70093         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
70094         return ret_conv;
70095 }
70096
70097 uint64_t  __attribute__((export_name("TS_OffersMessage_as_OnionMessageContents"))) TS_OffersMessage_as_OnionMessageContents(uint64_t this_arg) {
70098         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
70099         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70100         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
70101         return tag_ptr(ret_ret, true);
70102 }
70103
70104 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
70105         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
70106         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
70107         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70108         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70109         CVec_u8Z_free(ret_var);
70110         return ret_arr;
70111 }
70112
70113 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
70114         LDKu8slice ser_ref;
70115         ser_ref.datalen = ser->arr_len;
70116         ser_ref.data = ser->elems;
70117         void* arg_b_ptr = untag_ptr(arg_b);
70118         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
70119         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
70120         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
70121         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
70122         FREE(ser);
70123         return tag_ptr(ret_conv, true);
70124 }
70125
70126 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
70127         LDKPacket this_obj_conv;
70128         this_obj_conv.inner = untag_ptr(this_obj);
70129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70131         Packet_free(this_obj_conv);
70132 }
70133
70134 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
70135         LDKPacket this_ptr_conv;
70136         this_ptr_conv.inner = untag_ptr(this_ptr);
70137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70139         this_ptr_conv.is_owned = false;
70140         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
70141         return ret_conv;
70142 }
70143
70144 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
70145         LDKPacket this_ptr_conv;
70146         this_ptr_conv.inner = untag_ptr(this_ptr);
70147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70149         this_ptr_conv.is_owned = false;
70150         Packet_set_version(&this_ptr_conv, val);
70151 }
70152
70153 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
70154         LDKPacket this_ptr_conv;
70155         this_ptr_conv.inner = untag_ptr(this_ptr);
70156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70158         this_ptr_conv.is_owned = false;
70159         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70160         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
70161         return ret_arr;
70162 }
70163
70164 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
70165         LDKPacket this_ptr_conv;
70166         this_ptr_conv.inner = untag_ptr(this_ptr);
70167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70169         this_ptr_conv.is_owned = false;
70170         LDKPublicKey val_ref;
70171         CHECK(val->arr_len == 33);
70172         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70173         Packet_set_public_key(&this_ptr_conv, val_ref);
70174 }
70175
70176 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
70177         LDKPacket this_ptr_conv;
70178         this_ptr_conv.inner = untag_ptr(this_ptr);
70179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70181         this_ptr_conv.is_owned = false;
70182         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
70183         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70184         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70185         CVec_u8Z_free(ret_var);
70186         return ret_arr;
70187 }
70188
70189 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
70190         LDKPacket this_ptr_conv;
70191         this_ptr_conv.inner = untag_ptr(this_ptr);
70192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70194         this_ptr_conv.is_owned = false;
70195         LDKCVec_u8Z val_ref;
70196         val_ref.datalen = val->arr_len;
70197         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70198         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
70199         Packet_set_hop_data(&this_ptr_conv, val_ref);
70200 }
70201
70202 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
70203         LDKPacket this_ptr_conv;
70204         this_ptr_conv.inner = untag_ptr(this_ptr);
70205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70207         this_ptr_conv.is_owned = false;
70208         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
70209         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
70210         return ret_arr;
70211 }
70212
70213 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
70214         LDKPacket this_ptr_conv;
70215         this_ptr_conv.inner = untag_ptr(this_ptr);
70216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70218         this_ptr_conv.is_owned = false;
70219         LDKThirtyTwoBytes val_ref;
70220         CHECK(val->arr_len == 32);
70221         memcpy(val_ref.data, val->elems, 32); FREE(val);
70222         Packet_set_hmac(&this_ptr_conv, val_ref);
70223 }
70224
70225 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) {
70226         LDKPublicKey public_key_arg_ref;
70227         CHECK(public_key_arg->arr_len == 33);
70228         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
70229         LDKCVec_u8Z hop_data_arg_ref;
70230         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
70231         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70232         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
70233         LDKThirtyTwoBytes hmac_arg_ref;
70234         CHECK(hmac_arg->arr_len == 32);
70235         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
70236         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
70237         uint64_t ret_ref = 0;
70238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70240         return ret_ref;
70241 }
70242
70243 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
70244         LDKPacket ret_var = Packet_clone(arg);
70245         uint64_t ret_ref = 0;
70246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70248         return ret_ref;
70249 }
70250 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
70251         LDKPacket arg_conv;
70252         arg_conv.inner = untag_ptr(arg);
70253         arg_conv.is_owned = ptr_is_owned(arg);
70254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70255         arg_conv.is_owned = false;
70256         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
70257         return ret_conv;
70258 }
70259
70260 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
70261         LDKPacket orig_conv;
70262         orig_conv.inner = untag_ptr(orig);
70263         orig_conv.is_owned = ptr_is_owned(orig);
70264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70265         orig_conv.is_owned = false;
70266         LDKPacket ret_var = Packet_clone(&orig_conv);
70267         uint64_t ret_ref = 0;
70268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70270         return ret_ref;
70271 }
70272
70273 int64_t  __attribute__((export_name("TS_Packet_hash"))) TS_Packet_hash(uint64_t o) {
70274         LDKPacket o_conv;
70275         o_conv.inner = untag_ptr(o);
70276         o_conv.is_owned = ptr_is_owned(o);
70277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70278         o_conv.is_owned = false;
70279         int64_t ret_conv = Packet_hash(&o_conv);
70280         return ret_conv;
70281 }
70282
70283 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
70284         LDKPacket a_conv;
70285         a_conv.inner = untag_ptr(a);
70286         a_conv.is_owned = ptr_is_owned(a);
70287         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70288         a_conv.is_owned = false;
70289         LDKPacket b_conv;
70290         b_conv.inner = untag_ptr(b);
70291         b_conv.is_owned = ptr_is_owned(b);
70292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70293         b_conv.is_owned = false;
70294         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
70295         return ret_conv;
70296 }
70297
70298 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
70299         LDKPacket obj_conv;
70300         obj_conv.inner = untag_ptr(obj);
70301         obj_conv.is_owned = ptr_is_owned(obj);
70302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70303         obj_conv.is_owned = false;
70304         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
70305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70307         CVec_u8Z_free(ret_var);
70308         return ret_arr;
70309 }
70310
70311 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
70312         if (!ptr_is_owned(this_ptr)) return;
70313         void* this_ptr_ptr = untag_ptr(this_ptr);
70314         CHECK_ACCESS(this_ptr_ptr);
70315         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
70316         FREE(untag_ptr(this_ptr));
70317         ParsedOnionMessageContents_free(this_ptr_conv);
70318 }
70319
70320 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
70321         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70322         *ret_copy = ParsedOnionMessageContents_clone(arg);
70323         uint64_t ret_ref = tag_ptr(ret_copy, true);
70324         return ret_ref;
70325 }
70326 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
70327         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
70328         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
70329         return ret_conv;
70330 }
70331
70332 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
70333         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
70334         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70335         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
70336         uint64_t ret_ref = tag_ptr(ret_copy, true);
70337         return ret_ref;
70338 }
70339
70340 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
70341         void* a_ptr = untag_ptr(a);
70342         CHECK_ACCESS(a_ptr);
70343         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
70344         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
70345         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70346         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
70347         uint64_t ret_ref = tag_ptr(ret_copy, true);
70348         return ret_ref;
70349 }
70350
70351 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
70352         void* a_ptr = untag_ptr(a);
70353         CHECK_ACCESS(a_ptr);
70354         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
70355         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
70356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70357                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
70358         }
70359         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70360         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
70361         uint64_t ret_ref = tag_ptr(ret_copy, true);
70362         return ret_ref;
70363 }
70364
70365 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
70366         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
70367         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70368         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
70369         return tag_ptr(ret_ret, true);
70370 }
70371
70372 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
70373         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
70374         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
70375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70377         CVec_u8Z_free(ret_var);
70378         return ret_arr;
70379 }
70380
70381 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
70382         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70383         *ret_ret = OnionMessageContents_clone(arg);
70384         return tag_ptr(ret_ret, true);
70385 }
70386 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
70387         void* arg_ptr = untag_ptr(arg);
70388         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
70389         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
70390         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
70391         return ret_conv;
70392 }
70393
70394 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
70395         void* orig_ptr = untag_ptr(orig);
70396         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
70397         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
70398         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70399         *ret_ret = OnionMessageContents_clone(orig_conv);
70400         return tag_ptr(ret_ret, true);
70401 }
70402
70403 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
70404         if (!ptr_is_owned(this_ptr)) return;
70405         void* this_ptr_ptr = untag_ptr(this_ptr);
70406         CHECK_ACCESS(this_ptr_ptr);
70407         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
70408         FREE(untag_ptr(this_ptr));
70409         OnionMessageContents_free(this_ptr_conv);
70410 }
70411
70412 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
70413         LDKBlindedPath this_obj_conv;
70414         this_obj_conv.inner = untag_ptr(this_obj);
70415         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70417         BlindedPath_free(this_obj_conv);
70418 }
70419
70420 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_introduction_node_id"))) TS_BlindedPath_get_introduction_node_id(uint64_t this_ptr) {
70421         LDKBlindedPath this_ptr_conv;
70422         this_ptr_conv.inner = untag_ptr(this_ptr);
70423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70425         this_ptr_conv.is_owned = false;
70426         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70427         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
70428         return ret_arr;
70429 }
70430
70431 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node_id"))) TS_BlindedPath_set_introduction_node_id(uint64_t this_ptr, int8_tArray val) {
70432         LDKBlindedPath this_ptr_conv;
70433         this_ptr_conv.inner = untag_ptr(this_ptr);
70434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70436         this_ptr_conv.is_owned = false;
70437         LDKPublicKey val_ref;
70438         CHECK(val->arr_len == 33);
70439         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70440         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
70441 }
70442
70443 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
70444         LDKBlindedPath this_ptr_conv;
70445         this_ptr_conv.inner = untag_ptr(this_ptr);
70446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70448         this_ptr_conv.is_owned = false;
70449         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70450         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70451         return ret_arr;
70452 }
70453
70454 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
70455         LDKBlindedPath this_ptr_conv;
70456         this_ptr_conv.inner = untag_ptr(this_ptr);
70457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70459         this_ptr_conv.is_owned = false;
70460         LDKPublicKey val_ref;
70461         CHECK(val->arr_len == 33);
70462         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70463         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
70464 }
70465
70466 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
70467         LDKBlindedPath this_ptr_conv;
70468         this_ptr_conv.inner = untag_ptr(this_ptr);
70469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70471         this_ptr_conv.is_owned = false;
70472         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
70473         uint64_tArray ret_arr = NULL;
70474         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70475         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70476         for (size_t m = 0; m < ret_var.datalen; m++) {
70477                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70478                 uint64_t ret_conv_12_ref = 0;
70479                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70480                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70481                 ret_arr_ptr[m] = ret_conv_12_ref;
70482         }
70483         
70484         FREE(ret_var.data);
70485         return ret_arr;
70486 }
70487
70488 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
70489         LDKBlindedPath this_ptr_conv;
70490         this_ptr_conv.inner = untag_ptr(this_ptr);
70491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70493         this_ptr_conv.is_owned = false;
70494         LDKCVec_BlindedHopZ val_constr;
70495         val_constr.datalen = val->arr_len;
70496         if (val_constr.datalen > 0)
70497                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70498         else
70499                 val_constr.data = NULL;
70500         uint64_t* val_vals = val->elems;
70501         for (size_t m = 0; m < val_constr.datalen; m++) {
70502                 uint64_t val_conv_12 = val_vals[m];
70503                 LDKBlindedHop val_conv_12_conv;
70504                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70505                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70506                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70507                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70508                 val_constr.data[m] = val_conv_12_conv;
70509         }
70510         FREE(val);
70511         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
70512 }
70513
70514 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) {
70515         LDKPublicKey introduction_node_id_arg_ref;
70516         CHECK(introduction_node_id_arg->arr_len == 33);
70517         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
70518         LDKPublicKey blinding_point_arg_ref;
70519         CHECK(blinding_point_arg->arr_len == 33);
70520         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70521         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
70522         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
70523         if (blinded_hops_arg_constr.datalen > 0)
70524                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70525         else
70526                 blinded_hops_arg_constr.data = NULL;
70527         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
70528         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
70529                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
70530                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
70531                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
70532                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
70533                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
70534                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
70535                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
70536         }
70537         FREE(blinded_hops_arg);
70538         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
70539         uint64_t ret_ref = 0;
70540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70542         return ret_ref;
70543 }
70544
70545 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
70546         LDKBlindedPath ret_var = BlindedPath_clone(arg);
70547         uint64_t ret_ref = 0;
70548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70550         return ret_ref;
70551 }
70552 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
70553         LDKBlindedPath arg_conv;
70554         arg_conv.inner = untag_ptr(arg);
70555         arg_conv.is_owned = ptr_is_owned(arg);
70556         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70557         arg_conv.is_owned = false;
70558         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
70559         return ret_conv;
70560 }
70561
70562 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
70563         LDKBlindedPath orig_conv;
70564         orig_conv.inner = untag_ptr(orig);
70565         orig_conv.is_owned = ptr_is_owned(orig);
70566         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70567         orig_conv.is_owned = false;
70568         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
70569         uint64_t ret_ref = 0;
70570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70572         return ret_ref;
70573 }
70574
70575 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
70576         LDKBlindedPath o_conv;
70577         o_conv.inner = untag_ptr(o);
70578         o_conv.is_owned = ptr_is_owned(o);
70579         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70580         o_conv.is_owned = false;
70581         int64_t ret_conv = BlindedPath_hash(&o_conv);
70582         return ret_conv;
70583 }
70584
70585 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
70586         LDKBlindedPath a_conv;
70587         a_conv.inner = untag_ptr(a);
70588         a_conv.is_owned = ptr_is_owned(a);
70589         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70590         a_conv.is_owned = false;
70591         LDKBlindedPath b_conv;
70592         b_conv.inner = untag_ptr(b);
70593         b_conv.is_owned = ptr_is_owned(b);
70594         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70595         b_conv.is_owned = false;
70596         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
70597         return ret_conv;
70598 }
70599
70600 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
70601         LDKBlindedHop this_obj_conv;
70602         this_obj_conv.inner = untag_ptr(this_obj);
70603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70605         BlindedHop_free(this_obj_conv);
70606 }
70607
70608 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
70609         LDKBlindedHop this_ptr_conv;
70610         this_ptr_conv.inner = untag_ptr(this_ptr);
70611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70613         this_ptr_conv.is_owned = false;
70614         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70615         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
70616         return ret_arr;
70617 }
70618
70619 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
70620         LDKBlindedHop this_ptr_conv;
70621         this_ptr_conv.inner = untag_ptr(this_ptr);
70622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70624         this_ptr_conv.is_owned = false;
70625         LDKPublicKey val_ref;
70626         CHECK(val->arr_len == 33);
70627         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70628         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
70629 }
70630
70631 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
70632         LDKBlindedHop this_ptr_conv;
70633         this_ptr_conv.inner = untag_ptr(this_ptr);
70634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70636         this_ptr_conv.is_owned = false;
70637         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
70638         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70639         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70640         CVec_u8Z_free(ret_var);
70641         return ret_arr;
70642 }
70643
70644 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
70645         LDKBlindedHop this_ptr_conv;
70646         this_ptr_conv.inner = untag_ptr(this_ptr);
70647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70649         this_ptr_conv.is_owned = false;
70650         LDKCVec_u8Z val_ref;
70651         val_ref.datalen = val->arr_len;
70652         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70653         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
70654         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
70655 }
70656
70657 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
70658         LDKPublicKey blinded_node_id_arg_ref;
70659         CHECK(blinded_node_id_arg->arr_len == 33);
70660         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
70661         LDKCVec_u8Z encrypted_payload_arg_ref;
70662         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
70663         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70664         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
70665         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
70666         uint64_t ret_ref = 0;
70667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70669         return ret_ref;
70670 }
70671
70672 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
70673         LDKBlindedHop ret_var = BlindedHop_clone(arg);
70674         uint64_t ret_ref = 0;
70675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70677         return ret_ref;
70678 }
70679 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
70680         LDKBlindedHop arg_conv;
70681         arg_conv.inner = untag_ptr(arg);
70682         arg_conv.is_owned = ptr_is_owned(arg);
70683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70684         arg_conv.is_owned = false;
70685         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
70686         return ret_conv;
70687 }
70688
70689 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
70690         LDKBlindedHop orig_conv;
70691         orig_conv.inner = untag_ptr(orig);
70692         orig_conv.is_owned = ptr_is_owned(orig);
70693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70694         orig_conv.is_owned = false;
70695         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
70696         uint64_t ret_ref = 0;
70697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70699         return ret_ref;
70700 }
70701
70702 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
70703         LDKBlindedHop o_conv;
70704         o_conv.inner = untag_ptr(o);
70705         o_conv.is_owned = ptr_is_owned(o);
70706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70707         o_conv.is_owned = false;
70708         int64_t ret_conv = BlindedHop_hash(&o_conv);
70709         return ret_conv;
70710 }
70711
70712 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
70713         LDKBlindedHop a_conv;
70714         a_conv.inner = untag_ptr(a);
70715         a_conv.is_owned = ptr_is_owned(a);
70716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70717         a_conv.is_owned = false;
70718         LDKBlindedHop b_conv;
70719         b_conv.inner = untag_ptr(b);
70720         b_conv.is_owned = ptr_is_owned(b);
70721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70722         b_conv.is_owned = false;
70723         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
70724         return ret_conv;
70725 }
70726
70727 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) {
70728         LDKPublicKey recipient_node_id_ref;
70729         CHECK(recipient_node_id->arr_len == 33);
70730         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
70731         void* entropy_source_ptr = untag_ptr(entropy_source);
70732         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70733         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70734         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70735         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
70736         return tag_ptr(ret_conv, true);
70737 }
70738
70739 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
70740         LDKCVec_PublicKeyZ node_pks_constr;
70741         node_pks_constr.datalen = node_pks->arr_len;
70742         if (node_pks_constr.datalen > 0)
70743                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
70744         else
70745                 node_pks_constr.data = NULL;
70746         int8_tArray* node_pks_vals = (void*) node_pks->elems;
70747         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
70748                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
70749                 LDKPublicKey node_pks_conv_12_ref;
70750                 CHECK(node_pks_conv_12->arr_len == 33);
70751                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
70752                 node_pks_constr.data[m] = node_pks_conv_12_ref;
70753         }
70754         FREE(node_pks);
70755         void* entropy_source_ptr = untag_ptr(entropy_source);
70756         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70757         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70758         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70759         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
70760         return tag_ptr(ret_conv, true);
70761 }
70762
70763 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) {
70764         LDKPublicKey payee_node_id_ref;
70765         CHECK(payee_node_id->arr_len == 33);
70766         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
70767         LDKReceiveTlvs payee_tlvs_conv;
70768         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
70769         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
70770         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
70771         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
70772         void* entropy_source_ptr = untag_ptr(entropy_source);
70773         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70774         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70775         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
70776         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
70777         return tag_ptr(ret_conv, true);
70778 }
70779
70780 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_payment"))) TS_BlindedPath_new_for_payment(uint64_tArray intermediate_nodes, int8_tArray payee_node_id, uint64_t payee_tlvs, int64_t htlc_maximum_msat, uint64_t entropy_source) {
70781         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
70782         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
70783         if (intermediate_nodes_constr.datalen > 0)
70784                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
70785         else
70786                 intermediate_nodes_constr.data = NULL;
70787         uint64_t* intermediate_nodes_vals = intermediate_nodes->elems;
70788         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
70789                 uint64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
70790                 LDKForwardNode intermediate_nodes_conv_13_conv;
70791                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
70792                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
70793                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
70794                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
70795                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
70796         }
70797         FREE(intermediate_nodes);
70798         LDKPublicKey payee_node_id_ref;
70799         CHECK(payee_node_id->arr_len == 33);
70800         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
70801         LDKReceiveTlvs payee_tlvs_conv;
70802         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
70803         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
70804         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
70805         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
70806         void* entropy_source_ptr = untag_ptr(entropy_source);
70807         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70808         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70809         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
70810         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, entropy_source_conv);
70811         return tag_ptr(ret_conv, true);
70812 }
70813
70814 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
70815         LDKBlindedPath obj_conv;
70816         obj_conv.inner = untag_ptr(obj);
70817         obj_conv.is_owned = ptr_is_owned(obj);
70818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70819         obj_conv.is_owned = false;
70820         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
70821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70823         CVec_u8Z_free(ret_var);
70824         return ret_arr;
70825 }
70826
70827 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
70828         LDKu8slice ser_ref;
70829         ser_ref.datalen = ser->arr_len;
70830         ser_ref.data = ser->elems;
70831         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
70832         *ret_conv = BlindedPath_read(ser_ref);
70833         FREE(ser);
70834         return tag_ptr(ret_conv, true);
70835 }
70836
70837 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
70838         LDKBlindedHop obj_conv;
70839         obj_conv.inner = untag_ptr(obj);
70840         obj_conv.is_owned = ptr_is_owned(obj);
70841         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70842         obj_conv.is_owned = false;
70843         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
70844         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70845         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70846         CVec_u8Z_free(ret_var);
70847         return ret_arr;
70848 }
70849
70850 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
70851         LDKu8slice ser_ref;
70852         ser_ref.datalen = ser->arr_len;
70853         ser_ref.data = ser->elems;
70854         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
70855         *ret_conv = BlindedHop_read(ser_ref);
70856         FREE(ser);
70857         return tag_ptr(ret_conv, true);
70858 }
70859
70860 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
70861         LDKForwardNode this_obj_conv;
70862         this_obj_conv.inner = untag_ptr(this_obj);
70863         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70865         ForwardNode_free(this_obj_conv);
70866 }
70867
70868 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
70869         LDKForwardNode this_ptr_conv;
70870         this_ptr_conv.inner = untag_ptr(this_ptr);
70871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70873         this_ptr_conv.is_owned = false;
70874         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
70875         uint64_t ret_ref = 0;
70876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70878         return ret_ref;
70879 }
70880
70881 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
70882         LDKForwardNode this_ptr_conv;
70883         this_ptr_conv.inner = untag_ptr(this_ptr);
70884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70886         this_ptr_conv.is_owned = false;
70887         LDKForwardTlvs val_conv;
70888         val_conv.inner = untag_ptr(val);
70889         val_conv.is_owned = ptr_is_owned(val);
70890         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70891         val_conv = ForwardTlvs_clone(&val_conv);
70892         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
70893 }
70894
70895 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
70896         LDKForwardNode this_ptr_conv;
70897         this_ptr_conv.inner = untag_ptr(this_ptr);
70898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70900         this_ptr_conv.is_owned = false;
70901         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70902         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
70903         return ret_arr;
70904 }
70905
70906 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
70907         LDKForwardNode this_ptr_conv;
70908         this_ptr_conv.inner = untag_ptr(this_ptr);
70909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70911         this_ptr_conv.is_owned = false;
70912         LDKPublicKey val_ref;
70913         CHECK(val->arr_len == 33);
70914         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70915         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
70916 }
70917
70918 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
70919         LDKForwardNode this_ptr_conv;
70920         this_ptr_conv.inner = untag_ptr(this_ptr);
70921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70923         this_ptr_conv.is_owned = false;
70924         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
70925         return ret_conv;
70926 }
70927
70928 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
70929         LDKForwardNode this_ptr_conv;
70930         this_ptr_conv.inner = untag_ptr(this_ptr);
70931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70933         this_ptr_conv.is_owned = false;
70934         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
70935 }
70936
70937 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) {
70938         LDKForwardTlvs tlvs_arg_conv;
70939         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
70940         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
70941         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
70942         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
70943         LDKPublicKey node_id_arg_ref;
70944         CHECK(node_id_arg->arr_len == 33);
70945         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
70946         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
70947         uint64_t ret_ref = 0;
70948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70950         return ret_ref;
70951 }
70952
70953 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
70954         LDKForwardNode ret_var = ForwardNode_clone(arg);
70955         uint64_t ret_ref = 0;
70956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70958         return ret_ref;
70959 }
70960 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
70961         LDKForwardNode arg_conv;
70962         arg_conv.inner = untag_ptr(arg);
70963         arg_conv.is_owned = ptr_is_owned(arg);
70964         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70965         arg_conv.is_owned = false;
70966         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
70967         return ret_conv;
70968 }
70969
70970 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
70971         LDKForwardNode orig_conv;
70972         orig_conv.inner = untag_ptr(orig);
70973         orig_conv.is_owned = ptr_is_owned(orig);
70974         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70975         orig_conv.is_owned = false;
70976         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
70977         uint64_t ret_ref = 0;
70978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70980         return ret_ref;
70981 }
70982
70983 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
70984         LDKForwardTlvs this_obj_conv;
70985         this_obj_conv.inner = untag_ptr(this_obj);
70986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70988         ForwardTlvs_free(this_obj_conv);
70989 }
70990
70991 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
70992         LDKForwardTlvs this_ptr_conv;
70993         this_ptr_conv.inner = untag_ptr(this_ptr);
70994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70996         this_ptr_conv.is_owned = false;
70997         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
70998         return ret_conv;
70999 }
71000
71001 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71002         LDKForwardTlvs this_ptr_conv;
71003         this_ptr_conv.inner = untag_ptr(this_ptr);
71004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71006         this_ptr_conv.is_owned = false;
71007         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
71008 }
71009
71010 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
71011         LDKForwardTlvs this_ptr_conv;
71012         this_ptr_conv.inner = untag_ptr(this_ptr);
71013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71015         this_ptr_conv.is_owned = false;
71016         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
71017         uint64_t ret_ref = 0;
71018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71020         return ret_ref;
71021 }
71022
71023 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
71024         LDKForwardTlvs this_ptr_conv;
71025         this_ptr_conv.inner = untag_ptr(this_ptr);
71026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71028         this_ptr_conv.is_owned = false;
71029         LDKPaymentRelay val_conv;
71030         val_conv.inner = untag_ptr(val);
71031         val_conv.is_owned = ptr_is_owned(val);
71032         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71033         val_conv = PaymentRelay_clone(&val_conv);
71034         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
71035 }
71036
71037 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
71038         LDKForwardTlvs this_ptr_conv;
71039         this_ptr_conv.inner = untag_ptr(this_ptr);
71040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71042         this_ptr_conv.is_owned = false;
71043         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
71044         uint64_t ret_ref = 0;
71045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71047         return ret_ref;
71048 }
71049
71050 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
71051         LDKForwardTlvs this_ptr_conv;
71052         this_ptr_conv.inner = untag_ptr(this_ptr);
71053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71055         this_ptr_conv.is_owned = false;
71056         LDKPaymentConstraints val_conv;
71057         val_conv.inner = untag_ptr(val);
71058         val_conv.is_owned = ptr_is_owned(val);
71059         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71060         val_conv = PaymentConstraints_clone(&val_conv);
71061         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71062 }
71063
71064 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
71065         LDKForwardTlvs this_ptr_conv;
71066         this_ptr_conv.inner = untag_ptr(this_ptr);
71067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71069         this_ptr_conv.is_owned = false;
71070         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
71071         uint64_t ret_ref = 0;
71072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71074         return ret_ref;
71075 }
71076
71077 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
71078         LDKForwardTlvs this_ptr_conv;
71079         this_ptr_conv.inner = untag_ptr(this_ptr);
71080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71082         this_ptr_conv.is_owned = false;
71083         LDKBlindedHopFeatures val_conv;
71084         val_conv.inner = untag_ptr(val);
71085         val_conv.is_owned = ptr_is_owned(val);
71086         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71087         val_conv = BlindedHopFeatures_clone(&val_conv);
71088         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
71089 }
71090
71091 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) {
71092         LDKPaymentRelay payment_relay_arg_conv;
71093         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
71094         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
71095         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
71096         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
71097         LDKPaymentConstraints payment_constraints_arg_conv;
71098         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71099         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71100         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71101         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71102         LDKBlindedHopFeatures features_arg_conv;
71103         features_arg_conv.inner = untag_ptr(features_arg);
71104         features_arg_conv.is_owned = ptr_is_owned(features_arg);
71105         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
71106         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
71107         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
71108         uint64_t ret_ref = 0;
71109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71111         return ret_ref;
71112 }
71113
71114 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
71115         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
71116         uint64_t ret_ref = 0;
71117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71119         return ret_ref;
71120 }
71121 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
71122         LDKForwardTlvs arg_conv;
71123         arg_conv.inner = untag_ptr(arg);
71124         arg_conv.is_owned = ptr_is_owned(arg);
71125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71126         arg_conv.is_owned = false;
71127         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
71128         return ret_conv;
71129 }
71130
71131 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
71132         LDKForwardTlvs orig_conv;
71133         orig_conv.inner = untag_ptr(orig);
71134         orig_conv.is_owned = ptr_is_owned(orig);
71135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71136         orig_conv.is_owned = false;
71137         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
71138         uint64_t ret_ref = 0;
71139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71141         return ret_ref;
71142 }
71143
71144 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
71145         LDKReceiveTlvs this_obj_conv;
71146         this_obj_conv.inner = untag_ptr(this_obj);
71147         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71149         ReceiveTlvs_free(this_obj_conv);
71150 }
71151
71152 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
71153         LDKReceiveTlvs this_ptr_conv;
71154         this_ptr_conv.inner = untag_ptr(this_ptr);
71155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71157         this_ptr_conv.is_owned = false;
71158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71159         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
71160         return ret_arr;
71161 }
71162
71163 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
71164         LDKReceiveTlvs this_ptr_conv;
71165         this_ptr_conv.inner = untag_ptr(this_ptr);
71166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71168         this_ptr_conv.is_owned = false;
71169         LDKThirtyTwoBytes val_ref;
71170         CHECK(val->arr_len == 32);
71171         memcpy(val_ref.data, val->elems, 32); FREE(val);
71172         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
71173 }
71174
71175 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
71176         LDKReceiveTlvs this_ptr_conv;
71177         this_ptr_conv.inner = untag_ptr(this_ptr);
71178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71180         this_ptr_conv.is_owned = false;
71181         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
71182         uint64_t ret_ref = 0;
71183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71185         return ret_ref;
71186 }
71187
71188 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
71189         LDKReceiveTlvs this_ptr_conv;
71190         this_ptr_conv.inner = untag_ptr(this_ptr);
71191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71193         this_ptr_conv.is_owned = false;
71194         LDKPaymentConstraints val_conv;
71195         val_conv.inner = untag_ptr(val);
71196         val_conv.is_owned = ptr_is_owned(val);
71197         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71198         val_conv = PaymentConstraints_clone(&val_conv);
71199         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71200 }
71201
71202 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg) {
71203         LDKThirtyTwoBytes payment_secret_arg_ref;
71204         CHECK(payment_secret_arg->arr_len == 32);
71205         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
71206         LDKPaymentConstraints payment_constraints_arg_conv;
71207         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71208         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71209         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71210         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71211         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
71212         uint64_t ret_ref = 0;
71213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71215         return ret_ref;
71216 }
71217
71218 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
71219         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
71220         uint64_t ret_ref = 0;
71221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71223         return ret_ref;
71224 }
71225 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
71226         LDKReceiveTlvs arg_conv;
71227         arg_conv.inner = untag_ptr(arg);
71228         arg_conv.is_owned = ptr_is_owned(arg);
71229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71230         arg_conv.is_owned = false;
71231         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
71232         return ret_conv;
71233 }
71234
71235 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
71236         LDKReceiveTlvs orig_conv;
71237         orig_conv.inner = untag_ptr(orig);
71238         orig_conv.is_owned = ptr_is_owned(orig);
71239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71240         orig_conv.is_owned = false;
71241         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
71242         uint64_t ret_ref = 0;
71243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71245         return ret_ref;
71246 }
71247
71248 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
71249         LDKPaymentRelay this_obj_conv;
71250         this_obj_conv.inner = untag_ptr(this_obj);
71251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71253         PaymentRelay_free(this_obj_conv);
71254 }
71255
71256 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
71257         LDKPaymentRelay this_ptr_conv;
71258         this_ptr_conv.inner = untag_ptr(this_ptr);
71259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71261         this_ptr_conv.is_owned = false;
71262         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
71263         return ret_conv;
71264 }
71265
71266 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
71267         LDKPaymentRelay this_ptr_conv;
71268         this_ptr_conv.inner = untag_ptr(this_ptr);
71269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71271         this_ptr_conv.is_owned = false;
71272         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
71273 }
71274
71275 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
71276         LDKPaymentRelay this_ptr_conv;
71277         this_ptr_conv.inner = untag_ptr(this_ptr);
71278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71280         this_ptr_conv.is_owned = false;
71281         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
71282         return ret_conv;
71283 }
71284
71285 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
71286         LDKPaymentRelay this_ptr_conv;
71287         this_ptr_conv.inner = untag_ptr(this_ptr);
71288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71290         this_ptr_conv.is_owned = false;
71291         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
71292 }
71293
71294 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
71295         LDKPaymentRelay this_ptr_conv;
71296         this_ptr_conv.inner = untag_ptr(this_ptr);
71297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71299         this_ptr_conv.is_owned = false;
71300         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
71301         return ret_conv;
71302 }
71303
71304 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
71305         LDKPaymentRelay this_ptr_conv;
71306         this_ptr_conv.inner = untag_ptr(this_ptr);
71307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71309         this_ptr_conv.is_owned = false;
71310         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
71311 }
71312
71313 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) {
71314         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
71315         uint64_t ret_ref = 0;
71316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71318         return ret_ref;
71319 }
71320
71321 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
71322         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
71323         uint64_t ret_ref = 0;
71324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71326         return ret_ref;
71327 }
71328 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
71329         LDKPaymentRelay arg_conv;
71330         arg_conv.inner = untag_ptr(arg);
71331         arg_conv.is_owned = ptr_is_owned(arg);
71332         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71333         arg_conv.is_owned = false;
71334         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
71335         return ret_conv;
71336 }
71337
71338 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
71339         LDKPaymentRelay orig_conv;
71340         orig_conv.inner = untag_ptr(orig);
71341         orig_conv.is_owned = ptr_is_owned(orig);
71342         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71343         orig_conv.is_owned = false;
71344         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
71345         uint64_t ret_ref = 0;
71346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71348         return ret_ref;
71349 }
71350
71351 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
71352         LDKPaymentConstraints this_obj_conv;
71353         this_obj_conv.inner = untag_ptr(this_obj);
71354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71356         PaymentConstraints_free(this_obj_conv);
71357 }
71358
71359 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
71360         LDKPaymentConstraints this_ptr_conv;
71361         this_ptr_conv.inner = untag_ptr(this_ptr);
71362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71364         this_ptr_conv.is_owned = false;
71365         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
71366         return ret_conv;
71367 }
71368
71369 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
71370         LDKPaymentConstraints this_ptr_conv;
71371         this_ptr_conv.inner = untag_ptr(this_ptr);
71372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71374         this_ptr_conv.is_owned = false;
71375         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
71376 }
71377
71378 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
71379         LDKPaymentConstraints this_ptr_conv;
71380         this_ptr_conv.inner = untag_ptr(this_ptr);
71381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71383         this_ptr_conv.is_owned = false;
71384         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
71385         return ret_conv;
71386 }
71387
71388 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
71389         LDKPaymentConstraints this_ptr_conv;
71390         this_ptr_conv.inner = untag_ptr(this_ptr);
71391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71393         this_ptr_conv.is_owned = false;
71394         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
71395 }
71396
71397 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
71398         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
71399         uint64_t ret_ref = 0;
71400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71402         return ret_ref;
71403 }
71404
71405 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
71406         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
71407         uint64_t ret_ref = 0;
71408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71410         return ret_ref;
71411 }
71412 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
71413         LDKPaymentConstraints arg_conv;
71414         arg_conv.inner = untag_ptr(arg);
71415         arg_conv.is_owned = ptr_is_owned(arg);
71416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71417         arg_conv.is_owned = false;
71418         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
71419         return ret_conv;
71420 }
71421
71422 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
71423         LDKPaymentConstraints orig_conv;
71424         orig_conv.inner = untag_ptr(orig);
71425         orig_conv.is_owned = ptr_is_owned(orig);
71426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71427         orig_conv.is_owned = false;
71428         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
71429         uint64_t ret_ref = 0;
71430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71432         return ret_ref;
71433 }
71434
71435 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
71436         LDKForwardTlvs obj_conv;
71437         obj_conv.inner = untag_ptr(obj);
71438         obj_conv.is_owned = ptr_is_owned(obj);
71439         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71440         obj_conv.is_owned = false;
71441         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
71442         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71443         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71444         CVec_u8Z_free(ret_var);
71445         return ret_arr;
71446 }
71447
71448 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
71449         LDKReceiveTlvs obj_conv;
71450         obj_conv.inner = untag_ptr(obj);
71451         obj_conv.is_owned = ptr_is_owned(obj);
71452         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71453         obj_conv.is_owned = false;
71454         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
71455         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71456         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71457         CVec_u8Z_free(ret_var);
71458         return ret_arr;
71459 }
71460
71461 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
71462         LDKPaymentRelay obj_conv;
71463         obj_conv.inner = untag_ptr(obj);
71464         obj_conv.is_owned = ptr_is_owned(obj);
71465         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71466         obj_conv.is_owned = false;
71467         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
71468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71470         CVec_u8Z_free(ret_var);
71471         return ret_arr;
71472 }
71473
71474 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
71475         LDKu8slice ser_ref;
71476         ser_ref.datalen = ser->arr_len;
71477         ser_ref.data = ser->elems;
71478         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
71479         *ret_conv = PaymentRelay_read(ser_ref);
71480         FREE(ser);
71481         return tag_ptr(ret_conv, true);
71482 }
71483
71484 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
71485         LDKPaymentConstraints obj_conv;
71486         obj_conv.inner = untag_ptr(obj);
71487         obj_conv.is_owned = ptr_is_owned(obj);
71488         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71489         obj_conv.is_owned = false;
71490         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
71491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71493         CVec_u8Z_free(ret_var);
71494         return ret_arr;
71495 }
71496
71497 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
71498         LDKu8slice ser_ref;
71499         ser_ref.datalen = ser->arr_len;
71500         ser_ref.data = ser->elems;
71501         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
71502         *ret_conv = PaymentConstraints_read(ser_ref);
71503         FREE(ser);
71504         return tag_ptr(ret_conv, true);
71505 }
71506
71507 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
71508         if (!ptr_is_owned(this_ptr)) return;
71509         void* this_ptr_ptr = untag_ptr(this_ptr);
71510         CHECK_ACCESS(this_ptr_ptr);
71511         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
71512         FREE(untag_ptr(this_ptr));
71513         PaymentPurpose_free(this_ptr_conv);
71514 }
71515
71516 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
71517         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71518         *ret_copy = PaymentPurpose_clone(arg);
71519         uint64_t ret_ref = tag_ptr(ret_copy, true);
71520         return ret_ref;
71521 }
71522 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
71523         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
71524         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
71525         return ret_conv;
71526 }
71527
71528 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
71529         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
71530         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71531         *ret_copy = PaymentPurpose_clone(orig_conv);
71532         uint64_t ret_ref = tag_ptr(ret_copy, true);
71533         return ret_ref;
71534 }
71535
71536 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
71537         void* payment_preimage_ptr = untag_ptr(payment_preimage);
71538         CHECK_ACCESS(payment_preimage_ptr);
71539         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
71540         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
71541         LDKThirtyTwoBytes payment_secret_ref;
71542         CHECK(payment_secret->arr_len == 32);
71543         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
71544         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71545         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
71546         uint64_t ret_ref = tag_ptr(ret_copy, true);
71547         return ret_ref;
71548 }
71549
71550 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
71551         LDKThirtyTwoBytes a_ref;
71552         CHECK(a->arr_len == 32);
71553         memcpy(a_ref.data, a->elems, 32); FREE(a);
71554         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71555         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
71556         uint64_t ret_ref = tag_ptr(ret_copy, true);
71557         return ret_ref;
71558 }
71559
71560 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
71561         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
71562         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
71563         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
71564         return ret_conv;
71565 }
71566
71567 uint64_t  __attribute__((export_name("TS_PaymentPurpose_preimage"))) TS_PaymentPurpose_preimage(uint64_t this_arg) {
71568         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
71569         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
71570         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
71571         uint64_t ret_ref = tag_ptr(ret_copy, true);
71572         return ret_ref;
71573 }
71574
71575 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
71576         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
71577         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
71578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71580         CVec_u8Z_free(ret_var);
71581         return ret_arr;
71582 }
71583
71584 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
71585         LDKu8slice ser_ref;
71586         ser_ref.datalen = ser->arr_len;
71587         ser_ref.data = ser->elems;
71588         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
71589         *ret_conv = PaymentPurpose_read(ser_ref);
71590         FREE(ser);
71591         return tag_ptr(ret_conv, true);
71592 }
71593
71594 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
71595         LDKClaimedHTLC this_obj_conv;
71596         this_obj_conv.inner = untag_ptr(this_obj);
71597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71599         ClaimedHTLC_free(this_obj_conv);
71600 }
71601
71602 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
71603         LDKClaimedHTLC this_ptr_conv;
71604         this_ptr_conv.inner = untag_ptr(this_ptr);
71605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71607         this_ptr_conv.is_owned = false;
71608         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71609         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
71610         return ret_arr;
71611 }
71612
71613 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
71614         LDKClaimedHTLC this_ptr_conv;
71615         this_ptr_conv.inner = untag_ptr(this_ptr);
71616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71618         this_ptr_conv.is_owned = false;
71619         LDKThirtyTwoBytes val_ref;
71620         CHECK(val->arr_len == 32);
71621         memcpy(val_ref.data, val->elems, 32); FREE(val);
71622         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
71623 }
71624
71625 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
71626         LDKClaimedHTLC this_ptr_conv;
71627         this_ptr_conv.inner = untag_ptr(this_ptr);
71628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71630         this_ptr_conv.is_owned = false;
71631         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
71632         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
71633         return ret_arr;
71634 }
71635
71636 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
71637         LDKClaimedHTLC this_ptr_conv;
71638         this_ptr_conv.inner = untag_ptr(this_ptr);
71639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71641         this_ptr_conv.is_owned = false;
71642         LDKU128 val_ref;
71643         CHECK(val->arr_len == 16);
71644         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
71645         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
71646 }
71647
71648 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
71649         LDKClaimedHTLC this_ptr_conv;
71650         this_ptr_conv.inner = untag_ptr(this_ptr);
71651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71653         this_ptr_conv.is_owned = false;
71654         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
71655         return ret_conv;
71656 }
71657
71658 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
71659         LDKClaimedHTLC this_ptr_conv;
71660         this_ptr_conv.inner = untag_ptr(this_ptr);
71661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71663         this_ptr_conv.is_owned = false;
71664         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
71665 }
71666
71667 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
71668         LDKClaimedHTLC this_ptr_conv;
71669         this_ptr_conv.inner = untag_ptr(this_ptr);
71670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71672         this_ptr_conv.is_owned = false;
71673         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
71674         return ret_conv;
71675 }
71676
71677 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
71678         LDKClaimedHTLC this_ptr_conv;
71679         this_ptr_conv.inner = untag_ptr(this_ptr);
71680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71682         this_ptr_conv.is_owned = false;
71683         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
71684 }
71685
71686 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat(uint64_t this_ptr) {
71687         LDKClaimedHTLC this_ptr_conv;
71688         this_ptr_conv.inner = untag_ptr(this_ptr);
71689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71691         this_ptr_conv.is_owned = false;
71692         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
71693         return ret_conv;
71694 }
71695
71696 void  __attribute__((export_name("TS_ClaimedHTLC_set_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_set_counterparty_skimmed_fee_msat(uint64_t this_ptr, int64_t val) {
71697         LDKClaimedHTLC this_ptr_conv;
71698         this_ptr_conv.inner = untag_ptr(this_ptr);
71699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71701         this_ptr_conv.is_owned = false;
71702         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
71703 }
71704
71705 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, int64_t counterparty_skimmed_fee_msat_arg) {
71706         LDKThirtyTwoBytes channel_id_arg_ref;
71707         CHECK(channel_id_arg->arr_len == 32);
71708         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
71709         LDKU128 user_channel_id_arg_ref;
71710         CHECK(user_channel_id_arg->arr_len == 16);
71711         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
71712         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
71713         uint64_t ret_ref = 0;
71714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71716         return ret_ref;
71717 }
71718
71719 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
71720         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
71721         uint64_t ret_ref = 0;
71722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71724         return ret_ref;
71725 }
71726 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
71727         LDKClaimedHTLC arg_conv;
71728         arg_conv.inner = untag_ptr(arg);
71729         arg_conv.is_owned = ptr_is_owned(arg);
71730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71731         arg_conv.is_owned = false;
71732         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
71733         return ret_conv;
71734 }
71735
71736 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
71737         LDKClaimedHTLC orig_conv;
71738         orig_conv.inner = untag_ptr(orig);
71739         orig_conv.is_owned = ptr_is_owned(orig);
71740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71741         orig_conv.is_owned = false;
71742         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
71743         uint64_t ret_ref = 0;
71744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71746         return ret_ref;
71747 }
71748
71749 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
71750         LDKClaimedHTLC a_conv;
71751         a_conv.inner = untag_ptr(a);
71752         a_conv.is_owned = ptr_is_owned(a);
71753         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71754         a_conv.is_owned = false;
71755         LDKClaimedHTLC b_conv;
71756         b_conv.inner = untag_ptr(b);
71757         b_conv.is_owned = ptr_is_owned(b);
71758         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71759         b_conv.is_owned = false;
71760         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
71761         return ret_conv;
71762 }
71763
71764 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
71765         LDKClaimedHTLC obj_conv;
71766         obj_conv.inner = untag_ptr(obj);
71767         obj_conv.is_owned = ptr_is_owned(obj);
71768         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71769         obj_conv.is_owned = false;
71770         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
71771         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71772         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71773         CVec_u8Z_free(ret_var);
71774         return ret_arr;
71775 }
71776
71777 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
71778         LDKu8slice ser_ref;
71779         ser_ref.datalen = ser->arr_len;
71780         ser_ref.data = ser->elems;
71781         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
71782         *ret_conv = ClaimedHTLC_read(ser_ref);
71783         FREE(ser);
71784         return tag_ptr(ret_conv, true);
71785 }
71786
71787 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
71788         if (!ptr_is_owned(this_ptr)) return;
71789         void* this_ptr_ptr = untag_ptr(this_ptr);
71790         CHECK_ACCESS(this_ptr_ptr);
71791         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
71792         FREE(untag_ptr(this_ptr));
71793         PathFailure_free(this_ptr_conv);
71794 }
71795
71796 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
71797         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71798         *ret_copy = PathFailure_clone(arg);
71799         uint64_t ret_ref = tag_ptr(ret_copy, true);
71800         return ret_ref;
71801 }
71802 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
71803         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
71804         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
71805         return ret_conv;
71806 }
71807
71808 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
71809         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
71810         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71811         *ret_copy = PathFailure_clone(orig_conv);
71812         uint64_t ret_ref = tag_ptr(ret_copy, true);
71813         return ret_ref;
71814 }
71815
71816 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
71817         void* err_ptr = untag_ptr(err);
71818         CHECK_ACCESS(err_ptr);
71819         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
71820         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
71821         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71822         *ret_copy = PathFailure_initial_send(err_conv);
71823         uint64_t ret_ref = tag_ptr(ret_copy, true);
71824         return ret_ref;
71825 }
71826
71827 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
71828         void* network_update_ptr = untag_ptr(network_update);
71829         CHECK_ACCESS(network_update_ptr);
71830         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
71831         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
71832         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71833         *ret_copy = PathFailure_on_path(network_update_conv);
71834         uint64_t ret_ref = tag_ptr(ret_copy, true);
71835         return ret_ref;
71836 }
71837
71838 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
71839         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
71840         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
71841         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
71842         return ret_conv;
71843 }
71844
71845 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
71846         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
71847         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
71848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71850         CVec_u8Z_free(ret_var);
71851         return ret_arr;
71852 }
71853
71854 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
71855         LDKu8slice ser_ref;
71856         ser_ref.datalen = ser->arr_len;
71857         ser_ref.data = ser->elems;
71858         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
71859         *ret_conv = PathFailure_read(ser_ref);
71860         FREE(ser);
71861         return tag_ptr(ret_conv, true);
71862 }
71863
71864 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
71865         if (!ptr_is_owned(this_ptr)) return;
71866         void* this_ptr_ptr = untag_ptr(this_ptr);
71867         CHECK_ACCESS(this_ptr_ptr);
71868         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
71869         FREE(untag_ptr(this_ptr));
71870         ClosureReason_free(this_ptr_conv);
71871 }
71872
71873 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
71874         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71875         *ret_copy = ClosureReason_clone(arg);
71876         uint64_t ret_ref = tag_ptr(ret_copy, true);
71877         return ret_ref;
71878 }
71879 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
71880         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
71881         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
71882         return ret_conv;
71883 }
71884
71885 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
71886         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
71887         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71888         *ret_copy = ClosureReason_clone(orig_conv);
71889         uint64_t ret_ref = tag_ptr(ret_copy, true);
71890         return ret_ref;
71891 }
71892
71893 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
71894         LDKUntrustedString peer_msg_conv;
71895         peer_msg_conv.inner = untag_ptr(peer_msg);
71896         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
71897         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
71898         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
71899         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71900         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
71901         uint64_t ret_ref = tag_ptr(ret_copy, true);
71902         return ret_ref;
71903 }
71904
71905 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
71906         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71907         *ret_copy = ClosureReason_holder_force_closed();
71908         uint64_t ret_ref = tag_ptr(ret_copy, true);
71909         return ret_ref;
71910 }
71911
71912 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
71913         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71914         *ret_copy = ClosureReason_cooperative_closure();
71915         uint64_t ret_ref = tag_ptr(ret_copy, true);
71916         return ret_ref;
71917 }
71918
71919 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
71920         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71921         *ret_copy = ClosureReason_commitment_tx_confirmed();
71922         uint64_t ret_ref = tag_ptr(ret_copy, true);
71923         return ret_ref;
71924 }
71925
71926 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
71927         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71928         *ret_copy = ClosureReason_funding_timed_out();
71929         uint64_t ret_ref = tag_ptr(ret_copy, true);
71930         return ret_ref;
71931 }
71932
71933 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
71934         LDKStr err_conv = str_ref_to_owned_c(err);
71935         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71936         *ret_copy = ClosureReason_processing_error(err_conv);
71937         uint64_t ret_ref = tag_ptr(ret_copy, true);
71938         return ret_ref;
71939 }
71940
71941 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
71942         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71943         *ret_copy = ClosureReason_disconnected_peer();
71944         uint64_t ret_ref = tag_ptr(ret_copy, true);
71945         return ret_ref;
71946 }
71947
71948 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
71949         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71950         *ret_copy = ClosureReason_outdated_channel_manager();
71951         uint64_t ret_ref = tag_ptr(ret_copy, true);
71952         return ret_ref;
71953 }
71954
71955 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
71956         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71957         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
71958         uint64_t ret_ref = tag_ptr(ret_copy, true);
71959         return ret_ref;
71960 }
71961
71962 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
71963         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71964         *ret_copy = ClosureReason_funding_batch_closure();
71965         uint64_t ret_ref = tag_ptr(ret_copy, true);
71966         return ret_ref;
71967 }
71968
71969 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
71970         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
71971         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
71972         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
71973         return ret_conv;
71974 }
71975
71976 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
71977         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
71978         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
71979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71981         CVec_u8Z_free(ret_var);
71982         return ret_arr;
71983 }
71984
71985 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
71986         LDKu8slice ser_ref;
71987         ser_ref.datalen = ser->arr_len;
71988         ser_ref.data = ser->elems;
71989         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
71990         *ret_conv = ClosureReason_read(ser_ref);
71991         FREE(ser);
71992         return tag_ptr(ret_conv, true);
71993 }
71994
71995 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
71996         if (!ptr_is_owned(this_ptr)) return;
71997         void* this_ptr_ptr = untag_ptr(this_ptr);
71998         CHECK_ACCESS(this_ptr_ptr);
71999         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
72000         FREE(untag_ptr(this_ptr));
72001         HTLCDestination_free(this_ptr_conv);
72002 }
72003
72004 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
72005         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72006         *ret_copy = HTLCDestination_clone(arg);
72007         uint64_t ret_ref = tag_ptr(ret_copy, true);
72008         return ret_ref;
72009 }
72010 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
72011         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
72012         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
72013         return ret_conv;
72014 }
72015
72016 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
72017         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
72018         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72019         *ret_copy = HTLCDestination_clone(orig_conv);
72020         uint64_t ret_ref = tag_ptr(ret_copy, true);
72021         return ret_ref;
72022 }
72023
72024 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
72025         LDKPublicKey node_id_ref;
72026         CHECK(node_id->arr_len == 33);
72027         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72028         LDKThirtyTwoBytes channel_id_ref;
72029         CHECK(channel_id->arr_len == 32);
72030         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72031         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72032         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
72033         uint64_t ret_ref = tag_ptr(ret_copy, true);
72034         return ret_ref;
72035 }
72036
72037 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
72038         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72039         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
72040         uint64_t ret_ref = tag_ptr(ret_copy, true);
72041         return ret_ref;
72042 }
72043
72044 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
72045         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72046         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
72047         uint64_t ret_ref = tag_ptr(ret_copy, true);
72048         return ret_ref;
72049 }
72050
72051 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
72052         LDKThirtyTwoBytes payment_hash_ref;
72053         CHECK(payment_hash->arr_len == 32);
72054         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72055         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72056         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
72057         uint64_t ret_ref = tag_ptr(ret_copy, true);
72058         return ret_ref;
72059 }
72060
72061 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
72062         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
72063         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
72064         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
72065         return ret_conv;
72066 }
72067
72068 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
72069         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
72070         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
72071         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72072         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72073         CVec_u8Z_free(ret_var);
72074         return ret_arr;
72075 }
72076
72077 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
72078         LDKu8slice ser_ref;
72079         ser_ref.datalen = ser->arr_len;
72080         ser_ref.data = ser->elems;
72081         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
72082         *ret_conv = HTLCDestination_read(ser_ref);
72083         FREE(ser);
72084         return tag_ptr(ret_conv, true);
72085 }
72086
72087 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
72088         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
72089         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
72090         return ret_conv;
72091 }
72092
72093 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
72094         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
72095         return ret_conv;
72096 }
72097
72098 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
72099         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
72100         return ret_conv;
72101 }
72102
72103 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
72104         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
72105         return ret_conv;
72106 }
72107
72108 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
72109         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
72110         return ret_conv;
72111 }
72112
72113 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
72114         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
72115         return ret_conv;
72116 }
72117
72118 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
72119         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
72120         return ret_conv;
72121 }
72122
72123 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
72124         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
72125         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
72126         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
72127         return ret_conv;
72128 }
72129
72130 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
72131         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
72132         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
72133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72135         CVec_u8Z_free(ret_var);
72136         return ret_arr;
72137 }
72138
72139 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
72140         LDKu8slice ser_ref;
72141         ser_ref.datalen = ser->arr_len;
72142         ser_ref.data = ser->elems;
72143         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
72144         *ret_conv = PaymentFailureReason_read(ser_ref);
72145         FREE(ser);
72146         return tag_ptr(ret_conv, true);
72147 }
72148
72149 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
72150         if (!ptr_is_owned(this_ptr)) return;
72151         void* this_ptr_ptr = untag_ptr(this_ptr);
72152         CHECK_ACCESS(this_ptr_ptr);
72153         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
72154         FREE(untag_ptr(this_ptr));
72155         Event_free(this_ptr_conv);
72156 }
72157
72158 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
72159         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72160         *ret_copy = Event_clone(arg);
72161         uint64_t ret_ref = tag_ptr(ret_copy, true);
72162         return ret_ref;
72163 }
72164 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
72165         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
72166         int64_t ret_conv = Event_clone_ptr(arg_conv);
72167         return ret_conv;
72168 }
72169
72170 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
72171         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
72172         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72173         *ret_copy = Event_clone(orig_conv);
72174         uint64_t ret_ref = tag_ptr(ret_copy, true);
72175         return ret_ref;
72176 }
72177
72178 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) {
72179         LDKThirtyTwoBytes temporary_channel_id_ref;
72180         CHECK(temporary_channel_id->arr_len == 32);
72181         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
72182         LDKPublicKey counterparty_node_id_ref;
72183         CHECK(counterparty_node_id->arr_len == 33);
72184         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72185         LDKCVec_u8Z output_script_ref;
72186         output_script_ref.datalen = output_script->arr_len;
72187         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
72188         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
72189         LDKU128 user_channel_id_ref;
72190         CHECK(user_channel_id->arr_len == 16);
72191         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72192         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72193         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
72194         uint64_t ret_ref = tag_ptr(ret_copy, true);
72195         return ret_ref;
72196 }
72197
72198 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) {
72199         LDKPublicKey receiver_node_id_ref;
72200         CHECK(receiver_node_id->arr_len == 33);
72201         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72202         LDKThirtyTwoBytes payment_hash_ref;
72203         CHECK(payment_hash->arr_len == 32);
72204         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72205         LDKRecipientOnionFields onion_fields_conv;
72206         onion_fields_conv.inner = untag_ptr(onion_fields);
72207         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
72208         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
72209         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
72210         void* purpose_ptr = untag_ptr(purpose);
72211         CHECK_ACCESS(purpose_ptr);
72212         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72213         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72214         void* via_channel_id_ptr = untag_ptr(via_channel_id);
72215         CHECK_ACCESS(via_channel_id_ptr);
72216         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
72217         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
72218         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
72219         CHECK_ACCESS(via_user_channel_id_ptr);
72220         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
72221         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
72222         void* claim_deadline_ptr = untag_ptr(claim_deadline);
72223         CHECK_ACCESS(claim_deadline_ptr);
72224         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
72225         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
72226         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72227         *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);
72228         uint64_t ret_ref = tag_ptr(ret_copy, true);
72229         return ret_ref;
72230 }
72231
72232 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) {
72233         LDKPublicKey receiver_node_id_ref;
72234         CHECK(receiver_node_id->arr_len == 33);
72235         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72236         LDKThirtyTwoBytes payment_hash_ref;
72237         CHECK(payment_hash->arr_len == 32);
72238         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72239         void* purpose_ptr = untag_ptr(purpose);
72240         CHECK_ACCESS(purpose_ptr);
72241         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72242         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72243         LDKCVec_ClaimedHTLCZ htlcs_constr;
72244         htlcs_constr.datalen = htlcs->arr_len;
72245         if (htlcs_constr.datalen > 0)
72246                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
72247         else
72248                 htlcs_constr.data = NULL;
72249         uint64_t* htlcs_vals = htlcs->elems;
72250         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
72251                 uint64_t htlcs_conv_13 = htlcs_vals[n];
72252                 LDKClaimedHTLC htlcs_conv_13_conv;
72253                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
72254                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
72255                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
72256                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
72257                 htlcs_constr.data[n] = htlcs_conv_13_conv;
72258         }
72259         FREE(htlcs);
72260         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
72261         CHECK_ACCESS(sender_intended_total_msat_ptr);
72262         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
72263         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
72264         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72265         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
72266         uint64_t ret_ref = tag_ptr(ret_copy, true);
72267         return ret_ref;
72268 }
72269
72270 uint64_t  __attribute__((export_name("TS_Event_connection_needed"))) TS_Event_connection_needed(int8_tArray node_id, uint64_tArray addresses) {
72271         LDKPublicKey node_id_ref;
72272         CHECK(node_id->arr_len == 33);
72273         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72274         LDKCVec_SocketAddressZ addresses_constr;
72275         addresses_constr.datalen = addresses->arr_len;
72276         if (addresses_constr.datalen > 0)
72277                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
72278         else
72279                 addresses_constr.data = NULL;
72280         uint64_t* addresses_vals = addresses->elems;
72281         for (size_t p = 0; p < addresses_constr.datalen; p++) {
72282                 uint64_t addresses_conv_15 = addresses_vals[p];
72283                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
72284                 CHECK_ACCESS(addresses_conv_15_ptr);
72285                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
72286                 addresses_constr.data[p] = addresses_conv_15_conv;
72287         }
72288         FREE(addresses);
72289         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72290         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
72291         uint64_t ret_ref = tag_ptr(ret_copy, true);
72292         return ret_ref;
72293 }
72294
72295 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
72296         LDKThirtyTwoBytes payment_id_ref;
72297         CHECK(payment_id->arr_len == 32);
72298         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72299         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72300         *ret_copy = Event_invoice_request_failed(payment_id_ref);
72301         uint64_t ret_ref = tag_ptr(ret_copy, true);
72302         return ret_ref;
72303 }
72304
72305 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) {
72306         void* payment_id_ptr = untag_ptr(payment_id);
72307         CHECK_ACCESS(payment_id_ptr);
72308         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72309         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72310         LDKThirtyTwoBytes payment_preimage_ref;
72311         CHECK(payment_preimage->arr_len == 32);
72312         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
72313         LDKThirtyTwoBytes payment_hash_ref;
72314         CHECK(payment_hash->arr_len == 32);
72315         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72316         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
72317         CHECK_ACCESS(fee_paid_msat_ptr);
72318         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
72319         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
72320         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72321         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
72322         uint64_t ret_ref = tag_ptr(ret_copy, true);
72323         return ret_ref;
72324 }
72325
72326 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
72327         LDKThirtyTwoBytes payment_id_ref;
72328         CHECK(payment_id->arr_len == 32);
72329         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72330         LDKThirtyTwoBytes payment_hash_ref;
72331         CHECK(payment_hash->arr_len == 32);
72332         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72333         void* reason_ptr = untag_ptr(reason);
72334         CHECK_ACCESS(reason_ptr);
72335         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
72336         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
72337         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72338         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
72339         uint64_t ret_ref = tag_ptr(ret_copy, true);
72340         return ret_ref;
72341 }
72342
72343 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) {
72344         LDKThirtyTwoBytes payment_id_ref;
72345         CHECK(payment_id->arr_len == 32);
72346         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72347         void* payment_hash_ptr = untag_ptr(payment_hash);
72348         CHECK_ACCESS(payment_hash_ptr);
72349         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
72350         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
72351         LDKPath path_conv;
72352         path_conv.inner = untag_ptr(path);
72353         path_conv.is_owned = ptr_is_owned(path);
72354         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72355         path_conv = Path_clone(&path_conv);
72356         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72357         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
72358         uint64_t ret_ref = tag_ptr(ret_copy, true);
72359         return ret_ref;
72360 }
72361
72362 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) {
72363         void* payment_id_ptr = untag_ptr(payment_id);
72364         CHECK_ACCESS(payment_id_ptr);
72365         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72366         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72367         LDKThirtyTwoBytes payment_hash_ref;
72368         CHECK(payment_hash->arr_len == 32);
72369         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72370         void* failure_ptr = untag_ptr(failure);
72371         CHECK_ACCESS(failure_ptr);
72372         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
72373         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
72374         LDKPath path_conv;
72375         path_conv.inner = untag_ptr(path);
72376         path_conv.is_owned = ptr_is_owned(path);
72377         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72378         path_conv = Path_clone(&path_conv);
72379         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72380         CHECK_ACCESS(short_channel_id_ptr);
72381         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72382         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72383         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72384         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
72385         uint64_t ret_ref = tag_ptr(ret_copy, true);
72386         return ret_ref;
72387 }
72388
72389 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
72390         LDKThirtyTwoBytes payment_id_ref;
72391         CHECK(payment_id->arr_len == 32);
72392         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72393         LDKThirtyTwoBytes payment_hash_ref;
72394         CHECK(payment_hash->arr_len == 32);
72395         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72396         LDKPath path_conv;
72397         path_conv.inner = untag_ptr(path);
72398         path_conv.is_owned = ptr_is_owned(path);
72399         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72400         path_conv = Path_clone(&path_conv);
72401         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72402         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
72403         uint64_t ret_ref = tag_ptr(ret_copy, true);
72404         return ret_ref;
72405 }
72406
72407 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) {
72408         LDKThirtyTwoBytes payment_id_ref;
72409         CHECK(payment_id->arr_len == 32);
72410         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72411         LDKThirtyTwoBytes payment_hash_ref;
72412         CHECK(payment_hash->arr_len == 32);
72413         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72414         LDKPath path_conv;
72415         path_conv.inner = untag_ptr(path);
72416         path_conv.is_owned = ptr_is_owned(path);
72417         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72418         path_conv = Path_clone(&path_conv);
72419         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72420         CHECK_ACCESS(short_channel_id_ptr);
72421         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72422         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72423         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72424         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
72425         uint64_t ret_ref = tag_ptr(ret_copy, true);
72426         return ret_ref;
72427 }
72428
72429 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
72430         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72431         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
72432         uint64_t ret_ref = tag_ptr(ret_copy, true);
72433         return ret_ref;
72434 }
72435
72436 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) {
72437         LDKThirtyTwoBytes intercept_id_ref;
72438         CHECK(intercept_id->arr_len == 32);
72439         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
72440         LDKThirtyTwoBytes payment_hash_ref;
72441         CHECK(payment_hash->arr_len == 32);
72442         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72443         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72444         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
72445         uint64_t ret_ref = tag_ptr(ret_copy, true);
72446         return ret_ref;
72447 }
72448
72449 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
72450         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
72451         outputs_constr.datalen = outputs->arr_len;
72452         if (outputs_constr.datalen > 0)
72453                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
72454         else
72455                 outputs_constr.data = NULL;
72456         uint64_t* outputs_vals = outputs->elems;
72457         for (size_t b = 0; b < outputs_constr.datalen; b++) {
72458                 uint64_t outputs_conv_27 = outputs_vals[b];
72459                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
72460                 CHECK_ACCESS(outputs_conv_27_ptr);
72461                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
72462                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
72463                 outputs_constr.data[b] = outputs_conv_27_conv;
72464         }
72465         FREE(outputs);
72466         void* channel_id_ptr = untag_ptr(channel_id);
72467         CHECK_ACCESS(channel_id_ptr);
72468         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
72469         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
72470         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72471         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
72472         uint64_t ret_ref = tag_ptr(ret_copy, true);
72473         return ret_ref;
72474 }
72475
72476 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) {
72477         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
72478         CHECK_ACCESS(prev_channel_id_ptr);
72479         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
72480         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
72481         void* next_channel_id_ptr = untag_ptr(next_channel_id);
72482         CHECK_ACCESS(next_channel_id_ptr);
72483         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
72484         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
72485         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
72486         CHECK_ACCESS(fee_earned_msat_ptr);
72487         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
72488         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
72489         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
72490         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
72491         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
72492         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
72493         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72494         *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);
72495         uint64_t ret_ref = tag_ptr(ret_copy, true);
72496         return ret_ref;
72497 }
72498
72499 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) {
72500         LDKThirtyTwoBytes channel_id_ref;
72501         CHECK(channel_id->arr_len == 32);
72502         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72503         LDKU128 user_channel_id_ref;
72504         CHECK(user_channel_id->arr_len == 16);
72505         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72506         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
72507         CHECK_ACCESS(former_temporary_channel_id_ptr);
72508         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
72509         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
72510         LDKPublicKey counterparty_node_id_ref;
72511         CHECK(counterparty_node_id->arr_len == 33);
72512         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72513         LDKOutPoint funding_txo_conv;
72514         funding_txo_conv.inner = untag_ptr(funding_txo);
72515         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
72516         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
72517         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
72518         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72519         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
72520         uint64_t ret_ref = tag_ptr(ret_copy, true);
72521         return ret_ref;
72522 }
72523
72524 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) {
72525         LDKThirtyTwoBytes channel_id_ref;
72526         CHECK(channel_id->arr_len == 32);
72527         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72528         LDKU128 user_channel_id_ref;
72529         CHECK(user_channel_id->arr_len == 16);
72530         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72531         LDKPublicKey counterparty_node_id_ref;
72532         CHECK(counterparty_node_id->arr_len == 33);
72533         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72534         LDKChannelTypeFeatures channel_type_conv;
72535         channel_type_conv.inner = untag_ptr(channel_type);
72536         channel_type_conv.is_owned = ptr_is_owned(channel_type);
72537         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
72538         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
72539         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72540         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
72541         uint64_t ret_ref = tag_ptr(ret_copy, true);
72542         return ret_ref;
72543 }
72544
72545 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, uint64_t channel_funding_txo) {
72546         LDKThirtyTwoBytes channel_id_ref;
72547         CHECK(channel_id->arr_len == 32);
72548         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72549         LDKU128 user_channel_id_ref;
72550         CHECK(user_channel_id->arr_len == 16);
72551         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72552         void* reason_ptr = untag_ptr(reason);
72553         CHECK_ACCESS(reason_ptr);
72554         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
72555         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
72556         LDKPublicKey counterparty_node_id_ref;
72557         CHECK(counterparty_node_id->arr_len == 33);
72558         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72559         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
72560         CHECK_ACCESS(channel_capacity_sats_ptr);
72561         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
72562         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
72563         LDKOutPoint channel_funding_txo_conv;
72564         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
72565         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
72566         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
72567         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
72568         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72569         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
72570         uint64_t ret_ref = tag_ptr(ret_copy, true);
72571         return ret_ref;
72572 }
72573
72574 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
72575         LDKThirtyTwoBytes channel_id_ref;
72576         CHECK(channel_id->arr_len == 32);
72577         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72578         LDKTransaction transaction_ref;
72579         transaction_ref.datalen = transaction->arr_len;
72580         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
72581         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
72582         transaction_ref.data_is_owned = true;
72583         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72584         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
72585         uint64_t ret_ref = tag_ptr(ret_copy, true);
72586         return ret_ref;
72587 }
72588
72589 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) {
72590         LDKThirtyTwoBytes temporary_channel_id_ref;
72591         CHECK(temporary_channel_id->arr_len == 32);
72592         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
72593         LDKPublicKey counterparty_node_id_ref;
72594         CHECK(counterparty_node_id->arr_len == 33);
72595         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72596         LDKChannelTypeFeatures channel_type_conv;
72597         channel_type_conv.inner = untag_ptr(channel_type);
72598         channel_type_conv.is_owned = ptr_is_owned(channel_type);
72599         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
72600         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
72601         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72602         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
72603         uint64_t ret_ref = tag_ptr(ret_copy, true);
72604         return ret_ref;
72605 }
72606
72607 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
72608         LDKThirtyTwoBytes prev_channel_id_ref;
72609         CHECK(prev_channel_id->arr_len == 32);
72610         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
72611         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
72612         CHECK_ACCESS(failed_next_destination_ptr);
72613         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
72614         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
72615         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72616         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
72617         uint64_t ret_ref = tag_ptr(ret_copy, true);
72618         return ret_ref;
72619 }
72620
72621 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
72622         void* a_ptr = untag_ptr(a);
72623         CHECK_ACCESS(a_ptr);
72624         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
72625         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
72626         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72627         *ret_copy = Event_bump_transaction(a_conv);
72628         uint64_t ret_ref = tag_ptr(ret_copy, true);
72629         return ret_ref;
72630 }
72631
72632 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
72633         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
72634         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
72635         jboolean ret_conv = Event_eq(a_conv, b_conv);
72636         return ret_conv;
72637 }
72638
72639 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
72640         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
72641         LDKCVec_u8Z ret_var = Event_write(obj_conv);
72642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72644         CVec_u8Z_free(ret_var);
72645         return ret_arr;
72646 }
72647
72648 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
72649         LDKu8slice ser_ref;
72650         ser_ref.datalen = ser->arr_len;
72651         ser_ref.data = ser->elems;
72652         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
72653         *ret_conv = Event_read(ser_ref);
72654         FREE(ser);
72655         return tag_ptr(ret_conv, true);
72656 }
72657
72658 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
72659         if (!ptr_is_owned(this_ptr)) return;
72660         void* this_ptr_ptr = untag_ptr(this_ptr);
72661         CHECK_ACCESS(this_ptr_ptr);
72662         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
72663         FREE(untag_ptr(this_ptr));
72664         MessageSendEvent_free(this_ptr_conv);
72665 }
72666
72667 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
72668         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72669         *ret_copy = MessageSendEvent_clone(arg);
72670         uint64_t ret_ref = tag_ptr(ret_copy, true);
72671         return ret_ref;
72672 }
72673 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
72674         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
72675         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
72676         return ret_conv;
72677 }
72678
72679 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
72680         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
72681         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72682         *ret_copy = MessageSendEvent_clone(orig_conv);
72683         uint64_t ret_ref = tag_ptr(ret_copy, true);
72684         return ret_ref;
72685 }
72686
72687 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
72688         LDKPublicKey node_id_ref;
72689         CHECK(node_id->arr_len == 33);
72690         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72691         LDKAcceptChannel msg_conv;
72692         msg_conv.inner = untag_ptr(msg);
72693         msg_conv.is_owned = ptr_is_owned(msg);
72694         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72695         msg_conv = AcceptChannel_clone(&msg_conv);
72696         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72697         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
72698         uint64_t ret_ref = tag_ptr(ret_copy, true);
72699         return ret_ref;
72700 }
72701
72702 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
72703         LDKPublicKey node_id_ref;
72704         CHECK(node_id->arr_len == 33);
72705         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72706         LDKAcceptChannelV2 msg_conv;
72707         msg_conv.inner = untag_ptr(msg);
72708         msg_conv.is_owned = ptr_is_owned(msg);
72709         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72710         msg_conv = AcceptChannelV2_clone(&msg_conv);
72711         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72712         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
72713         uint64_t ret_ref = tag_ptr(ret_copy, true);
72714         return ret_ref;
72715 }
72716
72717 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
72718         LDKPublicKey node_id_ref;
72719         CHECK(node_id->arr_len == 33);
72720         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72721         LDKOpenChannel msg_conv;
72722         msg_conv.inner = untag_ptr(msg);
72723         msg_conv.is_owned = ptr_is_owned(msg);
72724         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72725         msg_conv = OpenChannel_clone(&msg_conv);
72726         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72727         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
72728         uint64_t ret_ref = tag_ptr(ret_copy, true);
72729         return ret_ref;
72730 }
72731
72732 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
72733         LDKPublicKey node_id_ref;
72734         CHECK(node_id->arr_len == 33);
72735         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72736         LDKOpenChannelV2 msg_conv;
72737         msg_conv.inner = untag_ptr(msg);
72738         msg_conv.is_owned = ptr_is_owned(msg);
72739         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72740         msg_conv = OpenChannelV2_clone(&msg_conv);
72741         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72742         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
72743         uint64_t ret_ref = tag_ptr(ret_copy, true);
72744         return ret_ref;
72745 }
72746
72747 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
72748         LDKPublicKey node_id_ref;
72749         CHECK(node_id->arr_len == 33);
72750         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72751         LDKFundingCreated msg_conv;
72752         msg_conv.inner = untag_ptr(msg);
72753         msg_conv.is_owned = ptr_is_owned(msg);
72754         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72755         msg_conv = FundingCreated_clone(&msg_conv);
72756         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72757         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
72758         uint64_t ret_ref = tag_ptr(ret_copy, true);
72759         return ret_ref;
72760 }
72761
72762 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
72763         LDKPublicKey node_id_ref;
72764         CHECK(node_id->arr_len == 33);
72765         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72766         LDKFundingSigned msg_conv;
72767         msg_conv.inner = untag_ptr(msg);
72768         msg_conv.is_owned = ptr_is_owned(msg);
72769         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72770         msg_conv = FundingSigned_clone(&msg_conv);
72771         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72772         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
72773         uint64_t ret_ref = tag_ptr(ret_copy, true);
72774         return ret_ref;
72775 }
72776
72777 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_stfu"))) TS_MessageSendEvent_send_stfu(int8_tArray node_id, uint64_t msg) {
72778         LDKPublicKey node_id_ref;
72779         CHECK(node_id->arr_len == 33);
72780         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72781         LDKStfu msg_conv;
72782         msg_conv.inner = untag_ptr(msg);
72783         msg_conv.is_owned = ptr_is_owned(msg);
72784         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72785         msg_conv = Stfu_clone(&msg_conv);
72786         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72787         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
72788         uint64_t ret_ref = tag_ptr(ret_copy, true);
72789         return ret_ref;
72790 }
72791
72792 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice"))) TS_MessageSendEvent_send_splice(int8_tArray node_id, uint64_t msg) {
72793         LDKPublicKey node_id_ref;
72794         CHECK(node_id->arr_len == 33);
72795         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72796         LDKSplice msg_conv;
72797         msg_conv.inner = untag_ptr(msg);
72798         msg_conv.is_owned = ptr_is_owned(msg);
72799         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72800         msg_conv = Splice_clone(&msg_conv);
72801         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72802         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
72803         uint64_t ret_ref = tag_ptr(ret_copy, true);
72804         return ret_ref;
72805 }
72806
72807 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_ack"))) TS_MessageSendEvent_send_splice_ack(int8_tArray node_id, uint64_t msg) {
72808         LDKPublicKey node_id_ref;
72809         CHECK(node_id->arr_len == 33);
72810         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72811         LDKSpliceAck msg_conv;
72812         msg_conv.inner = untag_ptr(msg);
72813         msg_conv.is_owned = ptr_is_owned(msg);
72814         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72815         msg_conv = SpliceAck_clone(&msg_conv);
72816         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72817         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
72818         uint64_t ret_ref = tag_ptr(ret_copy, true);
72819         return ret_ref;
72820 }
72821
72822 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_locked"))) TS_MessageSendEvent_send_splice_locked(int8_tArray node_id, uint64_t msg) {
72823         LDKPublicKey node_id_ref;
72824         CHECK(node_id->arr_len == 33);
72825         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72826         LDKSpliceLocked msg_conv;
72827         msg_conv.inner = untag_ptr(msg);
72828         msg_conv.is_owned = ptr_is_owned(msg);
72829         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72830         msg_conv = SpliceLocked_clone(&msg_conv);
72831         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72832         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
72833         uint64_t ret_ref = tag_ptr(ret_copy, true);
72834         return ret_ref;
72835 }
72836
72837 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
72838         LDKPublicKey node_id_ref;
72839         CHECK(node_id->arr_len == 33);
72840         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72841         LDKTxAddInput msg_conv;
72842         msg_conv.inner = untag_ptr(msg);
72843         msg_conv.is_owned = ptr_is_owned(msg);
72844         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72845         msg_conv = TxAddInput_clone(&msg_conv);
72846         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72847         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
72848         uint64_t ret_ref = tag_ptr(ret_copy, true);
72849         return ret_ref;
72850 }
72851
72852 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
72853         LDKPublicKey node_id_ref;
72854         CHECK(node_id->arr_len == 33);
72855         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72856         LDKTxAddOutput msg_conv;
72857         msg_conv.inner = untag_ptr(msg);
72858         msg_conv.is_owned = ptr_is_owned(msg);
72859         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72860         msg_conv = TxAddOutput_clone(&msg_conv);
72861         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72862         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
72863         uint64_t ret_ref = tag_ptr(ret_copy, true);
72864         return ret_ref;
72865 }
72866
72867 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
72868         LDKPublicKey node_id_ref;
72869         CHECK(node_id->arr_len == 33);
72870         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72871         LDKTxRemoveInput msg_conv;
72872         msg_conv.inner = untag_ptr(msg);
72873         msg_conv.is_owned = ptr_is_owned(msg);
72874         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72875         msg_conv = TxRemoveInput_clone(&msg_conv);
72876         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72877         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
72878         uint64_t ret_ref = tag_ptr(ret_copy, true);
72879         return ret_ref;
72880 }
72881
72882 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
72883         LDKPublicKey node_id_ref;
72884         CHECK(node_id->arr_len == 33);
72885         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72886         LDKTxRemoveOutput msg_conv;
72887         msg_conv.inner = untag_ptr(msg);
72888         msg_conv.is_owned = ptr_is_owned(msg);
72889         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72890         msg_conv = TxRemoveOutput_clone(&msg_conv);
72891         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72892         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
72893         uint64_t ret_ref = tag_ptr(ret_copy, true);
72894         return ret_ref;
72895 }
72896
72897 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
72898         LDKPublicKey node_id_ref;
72899         CHECK(node_id->arr_len == 33);
72900         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72901         LDKTxComplete msg_conv;
72902         msg_conv.inner = untag_ptr(msg);
72903         msg_conv.is_owned = ptr_is_owned(msg);
72904         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72905         msg_conv = TxComplete_clone(&msg_conv);
72906         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72907         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
72908         uint64_t ret_ref = tag_ptr(ret_copy, true);
72909         return ret_ref;
72910 }
72911
72912 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
72913         LDKPublicKey node_id_ref;
72914         CHECK(node_id->arr_len == 33);
72915         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72916         LDKTxSignatures msg_conv;
72917         msg_conv.inner = untag_ptr(msg);
72918         msg_conv.is_owned = ptr_is_owned(msg);
72919         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72920         msg_conv = TxSignatures_clone(&msg_conv);
72921         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72922         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
72923         uint64_t ret_ref = tag_ptr(ret_copy, true);
72924         return ret_ref;
72925 }
72926
72927 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
72928         LDKPublicKey node_id_ref;
72929         CHECK(node_id->arr_len == 33);
72930         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72931         LDKTxInitRbf msg_conv;
72932         msg_conv.inner = untag_ptr(msg);
72933         msg_conv.is_owned = ptr_is_owned(msg);
72934         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72935         msg_conv = TxInitRbf_clone(&msg_conv);
72936         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72937         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
72938         uint64_t ret_ref = tag_ptr(ret_copy, true);
72939         return ret_ref;
72940 }
72941
72942 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
72943         LDKPublicKey node_id_ref;
72944         CHECK(node_id->arr_len == 33);
72945         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72946         LDKTxAckRbf msg_conv;
72947         msg_conv.inner = untag_ptr(msg);
72948         msg_conv.is_owned = ptr_is_owned(msg);
72949         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72950         msg_conv = TxAckRbf_clone(&msg_conv);
72951         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72952         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
72953         uint64_t ret_ref = tag_ptr(ret_copy, true);
72954         return ret_ref;
72955 }
72956
72957 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
72958         LDKPublicKey node_id_ref;
72959         CHECK(node_id->arr_len == 33);
72960         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72961         LDKTxAbort msg_conv;
72962         msg_conv.inner = untag_ptr(msg);
72963         msg_conv.is_owned = ptr_is_owned(msg);
72964         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72965         msg_conv = TxAbort_clone(&msg_conv);
72966         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72967         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
72968         uint64_t ret_ref = tag_ptr(ret_copy, true);
72969         return ret_ref;
72970 }
72971
72972 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
72973         LDKPublicKey node_id_ref;
72974         CHECK(node_id->arr_len == 33);
72975         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72976         LDKChannelReady msg_conv;
72977         msg_conv.inner = untag_ptr(msg);
72978         msg_conv.is_owned = ptr_is_owned(msg);
72979         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72980         msg_conv = ChannelReady_clone(&msg_conv);
72981         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72982         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
72983         uint64_t ret_ref = tag_ptr(ret_copy, true);
72984         return ret_ref;
72985 }
72986
72987 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
72988         LDKPublicKey node_id_ref;
72989         CHECK(node_id->arr_len == 33);
72990         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72991         LDKAnnouncementSignatures msg_conv;
72992         msg_conv.inner = untag_ptr(msg);
72993         msg_conv.is_owned = ptr_is_owned(msg);
72994         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72995         msg_conv = AnnouncementSignatures_clone(&msg_conv);
72996         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72997         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
72998         uint64_t ret_ref = tag_ptr(ret_copy, true);
72999         return ret_ref;
73000 }
73001
73002 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
73003         LDKPublicKey node_id_ref;
73004         CHECK(node_id->arr_len == 33);
73005         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73006         LDKCommitmentUpdate updates_conv;
73007         updates_conv.inner = untag_ptr(updates);
73008         updates_conv.is_owned = ptr_is_owned(updates);
73009         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
73010         updates_conv = CommitmentUpdate_clone(&updates_conv);
73011         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73012         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
73013         uint64_t ret_ref = tag_ptr(ret_copy, true);
73014         return ret_ref;
73015 }
73016
73017 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
73018         LDKPublicKey node_id_ref;
73019         CHECK(node_id->arr_len == 33);
73020         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73021         LDKRevokeAndACK msg_conv;
73022         msg_conv.inner = untag_ptr(msg);
73023         msg_conv.is_owned = ptr_is_owned(msg);
73024         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73025         msg_conv = RevokeAndACK_clone(&msg_conv);
73026         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73027         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
73028         uint64_t ret_ref = tag_ptr(ret_copy, true);
73029         return ret_ref;
73030 }
73031
73032 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
73033         LDKPublicKey node_id_ref;
73034         CHECK(node_id->arr_len == 33);
73035         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73036         LDKClosingSigned msg_conv;
73037         msg_conv.inner = untag_ptr(msg);
73038         msg_conv.is_owned = ptr_is_owned(msg);
73039         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73040         msg_conv = ClosingSigned_clone(&msg_conv);
73041         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73042         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
73043         uint64_t ret_ref = tag_ptr(ret_copy, true);
73044         return ret_ref;
73045 }
73046
73047 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
73048         LDKPublicKey node_id_ref;
73049         CHECK(node_id->arr_len == 33);
73050         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73051         LDKShutdown msg_conv;
73052         msg_conv.inner = untag_ptr(msg);
73053         msg_conv.is_owned = ptr_is_owned(msg);
73054         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73055         msg_conv = Shutdown_clone(&msg_conv);
73056         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73057         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
73058         uint64_t ret_ref = tag_ptr(ret_copy, true);
73059         return ret_ref;
73060 }
73061
73062 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
73063         LDKPublicKey node_id_ref;
73064         CHECK(node_id->arr_len == 33);
73065         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73066         LDKChannelReestablish msg_conv;
73067         msg_conv.inner = untag_ptr(msg);
73068         msg_conv.is_owned = ptr_is_owned(msg);
73069         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73070         msg_conv = ChannelReestablish_clone(&msg_conv);
73071         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73072         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
73073         uint64_t ret_ref = tag_ptr(ret_copy, true);
73074         return ret_ref;
73075 }
73076
73077 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) {
73078         LDKPublicKey node_id_ref;
73079         CHECK(node_id->arr_len == 33);
73080         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73081         LDKChannelAnnouncement msg_conv;
73082         msg_conv.inner = untag_ptr(msg);
73083         msg_conv.is_owned = ptr_is_owned(msg);
73084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73085         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73086         LDKChannelUpdate update_msg_conv;
73087         update_msg_conv.inner = untag_ptr(update_msg);
73088         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73089         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73090         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73091         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73092         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
73093         uint64_t ret_ref = tag_ptr(ret_copy, true);
73094         return ret_ref;
73095 }
73096
73097 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
73098         LDKChannelAnnouncement msg_conv;
73099         msg_conv.inner = untag_ptr(msg);
73100         msg_conv.is_owned = ptr_is_owned(msg);
73101         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73102         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73103         LDKChannelUpdate update_msg_conv;
73104         update_msg_conv.inner = untag_ptr(update_msg);
73105         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73106         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73107         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73108         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73109         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
73110         uint64_t ret_ref = tag_ptr(ret_copy, true);
73111         return ret_ref;
73112 }
73113
73114 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
73115         LDKChannelUpdate msg_conv;
73116         msg_conv.inner = untag_ptr(msg);
73117         msg_conv.is_owned = ptr_is_owned(msg);
73118         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73119         msg_conv = ChannelUpdate_clone(&msg_conv);
73120         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73121         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
73122         uint64_t ret_ref = tag_ptr(ret_copy, true);
73123         return ret_ref;
73124 }
73125
73126 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
73127         LDKNodeAnnouncement msg_conv;
73128         msg_conv.inner = untag_ptr(msg);
73129         msg_conv.is_owned = ptr_is_owned(msg);
73130         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73131         msg_conv = NodeAnnouncement_clone(&msg_conv);
73132         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73133         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
73134         uint64_t ret_ref = tag_ptr(ret_copy, true);
73135         return ret_ref;
73136 }
73137
73138 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
73139         LDKPublicKey node_id_ref;
73140         CHECK(node_id->arr_len == 33);
73141         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73142         LDKChannelUpdate msg_conv;
73143         msg_conv.inner = untag_ptr(msg);
73144         msg_conv.is_owned = ptr_is_owned(msg);
73145         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73146         msg_conv = ChannelUpdate_clone(&msg_conv);
73147         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73148         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
73149         uint64_t ret_ref = tag_ptr(ret_copy, true);
73150         return ret_ref;
73151 }
73152
73153 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
73154         LDKPublicKey node_id_ref;
73155         CHECK(node_id->arr_len == 33);
73156         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73157         void* action_ptr = untag_ptr(action);
73158         CHECK_ACCESS(action_ptr);
73159         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
73160         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
73161         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73162         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
73163         uint64_t ret_ref = tag_ptr(ret_copy, true);
73164         return ret_ref;
73165 }
73166
73167 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
73168         LDKPublicKey node_id_ref;
73169         CHECK(node_id->arr_len == 33);
73170         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73171         LDKQueryChannelRange msg_conv;
73172         msg_conv.inner = untag_ptr(msg);
73173         msg_conv.is_owned = ptr_is_owned(msg);
73174         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73175         msg_conv = QueryChannelRange_clone(&msg_conv);
73176         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73177         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
73178         uint64_t ret_ref = tag_ptr(ret_copy, true);
73179         return ret_ref;
73180 }
73181
73182 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
73183         LDKPublicKey node_id_ref;
73184         CHECK(node_id->arr_len == 33);
73185         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73186         LDKQueryShortChannelIds msg_conv;
73187         msg_conv.inner = untag_ptr(msg);
73188         msg_conv.is_owned = ptr_is_owned(msg);
73189         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73190         msg_conv = QueryShortChannelIds_clone(&msg_conv);
73191         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73192         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
73193         uint64_t ret_ref = tag_ptr(ret_copy, true);
73194         return ret_ref;
73195 }
73196
73197 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
73198         LDKPublicKey node_id_ref;
73199         CHECK(node_id->arr_len == 33);
73200         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73201         LDKReplyChannelRange msg_conv;
73202         msg_conv.inner = untag_ptr(msg);
73203         msg_conv.is_owned = ptr_is_owned(msg);
73204         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73205         msg_conv = ReplyChannelRange_clone(&msg_conv);
73206         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73207         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
73208         uint64_t ret_ref = tag_ptr(ret_copy, true);
73209         return ret_ref;
73210 }
73211
73212 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
73213         LDKPublicKey node_id_ref;
73214         CHECK(node_id->arr_len == 33);
73215         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73216         LDKGossipTimestampFilter msg_conv;
73217         msg_conv.inner = untag_ptr(msg);
73218         msg_conv.is_owned = ptr_is_owned(msg);
73219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73220         msg_conv = GossipTimestampFilter_clone(&msg_conv);
73221         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73222         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
73223         uint64_t ret_ref = tag_ptr(ret_copy, true);
73224         return ret_ref;
73225 }
73226
73227 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
73228         if (!ptr_is_owned(this_ptr)) return;
73229         void* this_ptr_ptr = untag_ptr(this_ptr);
73230         CHECK_ACCESS(this_ptr_ptr);
73231         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
73232         FREE(untag_ptr(this_ptr));
73233         MessageSendEventsProvider_free(this_ptr_conv);
73234 }
73235
73236 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
73237         if (!ptr_is_owned(this_ptr)) return;
73238         void* this_ptr_ptr = untag_ptr(this_ptr);
73239         CHECK_ACCESS(this_ptr_ptr);
73240         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
73241         FREE(untag_ptr(this_ptr));
73242         EventsProvider_free(this_ptr_conv);
73243 }
73244
73245 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
73246         if (!ptr_is_owned(this_ptr)) return;
73247         void* this_ptr_ptr = untag_ptr(this_ptr);
73248         CHECK_ACCESS(this_ptr_ptr);
73249         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
73250         FREE(untag_ptr(this_ptr));
73251         EventHandler_free(this_ptr_conv);
73252 }
73253
73254 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
73255         LDKAnchorDescriptor this_obj_conv;
73256         this_obj_conv.inner = untag_ptr(this_obj);
73257         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73259         AnchorDescriptor_free(this_obj_conv);
73260 }
73261
73262 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
73263         LDKAnchorDescriptor this_ptr_conv;
73264         this_ptr_conv.inner = untag_ptr(this_ptr);
73265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73267         this_ptr_conv.is_owned = false;
73268         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
73269         uint64_t ret_ref = 0;
73270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73272         return ret_ref;
73273 }
73274
73275 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
73276         LDKAnchorDescriptor this_ptr_conv;
73277         this_ptr_conv.inner = untag_ptr(this_ptr);
73278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73280         this_ptr_conv.is_owned = false;
73281         LDKChannelDerivationParameters val_conv;
73282         val_conv.inner = untag_ptr(val);
73283         val_conv.is_owned = ptr_is_owned(val);
73284         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73285         val_conv = ChannelDerivationParameters_clone(&val_conv);
73286         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
73287 }
73288
73289 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
73290         LDKAnchorDescriptor this_ptr_conv;
73291         this_ptr_conv.inner = untag_ptr(this_ptr);
73292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73294         this_ptr_conv.is_owned = false;
73295         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
73296         uint64_t ret_ref = 0;
73297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73299         return ret_ref;
73300 }
73301
73302 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
73303         LDKAnchorDescriptor this_ptr_conv;
73304         this_ptr_conv.inner = untag_ptr(this_ptr);
73305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73307         this_ptr_conv.is_owned = false;
73308         LDKOutPoint val_conv;
73309         val_conv.inner = untag_ptr(val);
73310         val_conv.is_owned = ptr_is_owned(val);
73311         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73312         val_conv = OutPoint_clone(&val_conv);
73313         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73314 }
73315
73316 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
73317         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
73318         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
73319         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
73320         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
73321         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
73322         LDKOutPoint outpoint_arg_conv;
73323         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73324         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73325         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73326         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73327         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
73328         uint64_t ret_ref = 0;
73329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73331         return ret_ref;
73332 }
73333
73334 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
73335         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
73336         uint64_t ret_ref = 0;
73337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73339         return ret_ref;
73340 }
73341 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
73342         LDKAnchorDescriptor arg_conv;
73343         arg_conv.inner = untag_ptr(arg);
73344         arg_conv.is_owned = ptr_is_owned(arg);
73345         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73346         arg_conv.is_owned = false;
73347         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
73348         return ret_conv;
73349 }
73350
73351 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
73352         LDKAnchorDescriptor orig_conv;
73353         orig_conv.inner = untag_ptr(orig);
73354         orig_conv.is_owned = ptr_is_owned(orig);
73355         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73356         orig_conv.is_owned = false;
73357         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
73358         uint64_t ret_ref = 0;
73359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73361         return ret_ref;
73362 }
73363
73364 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
73365         LDKAnchorDescriptor a_conv;
73366         a_conv.inner = untag_ptr(a);
73367         a_conv.is_owned = ptr_is_owned(a);
73368         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73369         a_conv.is_owned = false;
73370         LDKAnchorDescriptor b_conv;
73371         b_conv.inner = untag_ptr(b);
73372         b_conv.is_owned = ptr_is_owned(b);
73373         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73374         b_conv.is_owned = false;
73375         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
73376         return ret_conv;
73377 }
73378
73379 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
73380         LDKAnchorDescriptor this_arg_conv;
73381         this_arg_conv.inner = untag_ptr(this_arg);
73382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73384         this_arg_conv.is_owned = false;
73385         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73386         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
73387         return tag_ptr(ret_ref, true);
73388 }
73389
73390 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
73391         LDKAnchorDescriptor this_arg_conv;
73392         this_arg_conv.inner = untag_ptr(this_arg);
73393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73395         this_arg_conv.is_owned = false;
73396         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
73397         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
73398         return tag_ptr(ret_ref, true);
73399 }
73400
73401 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
73402         LDKAnchorDescriptor this_arg_conv;
73403         this_arg_conv.inner = untag_ptr(this_arg);
73404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73406         this_arg_conv.is_owned = false;
73407         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
73408         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73409         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73410         CVec_u8Z_free(ret_var);
73411         return ret_arr;
73412 }
73413
73414 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
73415         LDKAnchorDescriptor this_arg_conv;
73416         this_arg_conv.inner = untag_ptr(this_arg);
73417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73419         this_arg_conv.is_owned = false;
73420         LDKECDSASignature signature_ref;
73421         CHECK(signature->arr_len == 64);
73422         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
73423         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
73424         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73425         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73426         Witness_free(ret_var);
73427         return ret_arr;
73428 }
73429
73430 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
73431         LDKAnchorDescriptor this_arg_conv;
73432         this_arg_conv.inner = untag_ptr(this_arg);
73433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73435         this_arg_conv.is_owned = false;
73436         void* signer_provider_ptr = untag_ptr(signer_provider);
73437         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
73438         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
73439         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
73440         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
73441         return tag_ptr(ret_ret, true);
73442 }
73443
73444 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
73445         if (!ptr_is_owned(this_ptr)) return;
73446         void* this_ptr_ptr = untag_ptr(this_ptr);
73447         CHECK_ACCESS(this_ptr_ptr);
73448         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
73449         FREE(untag_ptr(this_ptr));
73450         BumpTransactionEvent_free(this_ptr_conv);
73451 }
73452
73453 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
73454         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73455         *ret_copy = BumpTransactionEvent_clone(arg);
73456         uint64_t ret_ref = tag_ptr(ret_copy, true);
73457         return ret_ref;
73458 }
73459 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
73460         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
73461         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
73462         return ret_conv;
73463 }
73464
73465 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
73466         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
73467         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73468         *ret_copy = BumpTransactionEvent_clone(orig_conv);
73469         uint64_t ret_ref = tag_ptr(ret_copy, true);
73470         return ret_ref;
73471 }
73472
73473 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) {
73474         LDKThirtyTwoBytes claim_id_ref;
73475         CHECK(claim_id->arr_len == 32);
73476         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73477         LDKTransaction commitment_tx_ref;
73478         commitment_tx_ref.datalen = commitment_tx->arr_len;
73479         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
73480         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
73481         commitment_tx_ref.data_is_owned = true;
73482         LDKAnchorDescriptor anchor_descriptor_conv;
73483         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
73484         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
73485         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
73486         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
73487         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
73488         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
73489         if (pending_htlcs_constr.datalen > 0)
73490                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
73491         else
73492                 pending_htlcs_constr.data = NULL;
73493         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
73494         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
73495                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
73496                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
73497                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
73498                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
73499                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
73500                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
73501                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
73502         }
73503         FREE(pending_htlcs);
73504         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73505         *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);
73506         uint64_t ret_ref = tag_ptr(ret_copy, true);
73507         return ret_ref;
73508 }
73509
73510 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) {
73511         LDKThirtyTwoBytes claim_id_ref;
73512         CHECK(claim_id->arr_len == 32);
73513         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73514         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
73515         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
73516         if (htlc_descriptors_constr.datalen > 0)
73517                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
73518         else
73519                 htlc_descriptors_constr.data = NULL;
73520         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
73521         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
73522                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
73523                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
73524                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
73525                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
73526                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
73527                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
73528                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
73529         }
73530         FREE(htlc_descriptors);
73531         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73532         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
73533         uint64_t ret_ref = tag_ptr(ret_copy, true);
73534         return ret_ref;
73535 }
73536
73537 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
73538         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
73539         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
73540         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
73541         return ret_conv;
73542 }
73543
73544 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
73545         LDKInput this_obj_conv;
73546         this_obj_conv.inner = untag_ptr(this_obj);
73547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73549         Input_free(this_obj_conv);
73550 }
73551
73552 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
73553         LDKInput this_ptr_conv;
73554         this_ptr_conv.inner = untag_ptr(this_ptr);
73555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73557         this_ptr_conv.is_owned = false;
73558         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
73559         uint64_t ret_ref = 0;
73560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73562         return ret_ref;
73563 }
73564
73565 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
73566         LDKInput this_ptr_conv;
73567         this_ptr_conv.inner = untag_ptr(this_ptr);
73568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73570         this_ptr_conv.is_owned = false;
73571         LDKOutPoint val_conv;
73572         val_conv.inner = untag_ptr(val);
73573         val_conv.is_owned = ptr_is_owned(val);
73574         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73575         val_conv = OutPoint_clone(&val_conv);
73576         Input_set_outpoint(&this_ptr_conv, val_conv);
73577 }
73578
73579 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
73580         LDKInput this_ptr_conv;
73581         this_ptr_conv.inner = untag_ptr(this_ptr);
73582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73584         this_ptr_conv.is_owned = false;
73585         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73586         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
73587         return tag_ptr(ret_ref, true);
73588 }
73589
73590 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
73591         LDKInput this_ptr_conv;
73592         this_ptr_conv.inner = untag_ptr(this_ptr);
73593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73595         this_ptr_conv.is_owned = false;
73596         void* val_ptr = untag_ptr(val);
73597         CHECK_ACCESS(val_ptr);
73598         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73599         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73600         Input_set_previous_utxo(&this_ptr_conv, val_conv);
73601 }
73602
73603 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
73604         LDKInput this_ptr_conv;
73605         this_ptr_conv.inner = untag_ptr(this_ptr);
73606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73608         this_ptr_conv.is_owned = false;
73609         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
73610         return ret_conv;
73611 }
73612
73613 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
73614         LDKInput this_ptr_conv;
73615         this_ptr_conv.inner = untag_ptr(this_ptr);
73616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73618         this_ptr_conv.is_owned = false;
73619         Input_set_satisfaction_weight(&this_ptr_conv, val);
73620 }
73621
73622 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) {
73623         LDKOutPoint outpoint_arg_conv;
73624         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73625         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73626         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73627         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73628         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
73629         CHECK_ACCESS(previous_utxo_arg_ptr);
73630         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
73631         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
73632         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
73633         uint64_t ret_ref = 0;
73634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73636         return ret_ref;
73637 }
73638
73639 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
73640         LDKInput ret_var = Input_clone(arg);
73641         uint64_t ret_ref = 0;
73642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73644         return ret_ref;
73645 }
73646 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
73647         LDKInput arg_conv;
73648         arg_conv.inner = untag_ptr(arg);
73649         arg_conv.is_owned = ptr_is_owned(arg);
73650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73651         arg_conv.is_owned = false;
73652         int64_t ret_conv = Input_clone_ptr(&arg_conv);
73653         return ret_conv;
73654 }
73655
73656 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
73657         LDKInput orig_conv;
73658         orig_conv.inner = untag_ptr(orig);
73659         orig_conv.is_owned = ptr_is_owned(orig);
73660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73661         orig_conv.is_owned = false;
73662         LDKInput ret_var = Input_clone(&orig_conv);
73663         uint64_t ret_ref = 0;
73664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73666         return ret_ref;
73667 }
73668
73669 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
73670         LDKInput o_conv;
73671         o_conv.inner = untag_ptr(o);
73672         o_conv.is_owned = ptr_is_owned(o);
73673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73674         o_conv.is_owned = false;
73675         int64_t ret_conv = Input_hash(&o_conv);
73676         return ret_conv;
73677 }
73678
73679 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
73680         LDKInput a_conv;
73681         a_conv.inner = untag_ptr(a);
73682         a_conv.is_owned = ptr_is_owned(a);
73683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73684         a_conv.is_owned = false;
73685         LDKInput b_conv;
73686         b_conv.inner = untag_ptr(b);
73687         b_conv.is_owned = ptr_is_owned(b);
73688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73689         b_conv.is_owned = false;
73690         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
73691         return ret_conv;
73692 }
73693
73694 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
73695         LDKUtxo this_obj_conv;
73696         this_obj_conv.inner = untag_ptr(this_obj);
73697         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73699         Utxo_free(this_obj_conv);
73700 }
73701
73702 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
73703         LDKUtxo this_ptr_conv;
73704         this_ptr_conv.inner = untag_ptr(this_ptr);
73705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73707         this_ptr_conv.is_owned = false;
73708         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
73709         uint64_t ret_ref = 0;
73710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73712         return ret_ref;
73713 }
73714
73715 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
73716         LDKUtxo this_ptr_conv;
73717         this_ptr_conv.inner = untag_ptr(this_ptr);
73718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73720         this_ptr_conv.is_owned = false;
73721         LDKOutPoint val_conv;
73722         val_conv.inner = untag_ptr(val);
73723         val_conv.is_owned = ptr_is_owned(val);
73724         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73725         val_conv = OutPoint_clone(&val_conv);
73726         Utxo_set_outpoint(&this_ptr_conv, val_conv);
73727 }
73728
73729 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
73730         LDKUtxo this_ptr_conv;
73731         this_ptr_conv.inner = untag_ptr(this_ptr);
73732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73734         this_ptr_conv.is_owned = false;
73735         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73736         *ret_ref = Utxo_get_output(&this_ptr_conv);
73737         return tag_ptr(ret_ref, true);
73738 }
73739
73740 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
73741         LDKUtxo this_ptr_conv;
73742         this_ptr_conv.inner = untag_ptr(this_ptr);
73743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73745         this_ptr_conv.is_owned = false;
73746         void* val_ptr = untag_ptr(val);
73747         CHECK_ACCESS(val_ptr);
73748         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73749         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73750         Utxo_set_output(&this_ptr_conv, val_conv);
73751 }
73752
73753 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
73754         LDKUtxo this_ptr_conv;
73755         this_ptr_conv.inner = untag_ptr(this_ptr);
73756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73758         this_ptr_conv.is_owned = false;
73759         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
73760         return ret_conv;
73761 }
73762
73763 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
73764         LDKUtxo this_ptr_conv;
73765         this_ptr_conv.inner = untag_ptr(this_ptr);
73766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73768         this_ptr_conv.is_owned = false;
73769         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
73770 }
73771
73772 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
73773         LDKOutPoint outpoint_arg_conv;
73774         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73775         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73776         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73777         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73778         void* output_arg_ptr = untag_ptr(output_arg);
73779         CHECK_ACCESS(output_arg_ptr);
73780         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73781         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73782         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
73783         uint64_t ret_ref = 0;
73784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73786         return ret_ref;
73787 }
73788
73789 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
73790         LDKUtxo ret_var = Utxo_clone(arg);
73791         uint64_t ret_ref = 0;
73792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73794         return ret_ref;
73795 }
73796 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
73797         LDKUtxo arg_conv;
73798         arg_conv.inner = untag_ptr(arg);
73799         arg_conv.is_owned = ptr_is_owned(arg);
73800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73801         arg_conv.is_owned = false;
73802         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
73803         return ret_conv;
73804 }
73805
73806 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
73807         LDKUtxo orig_conv;
73808         orig_conv.inner = untag_ptr(orig);
73809         orig_conv.is_owned = ptr_is_owned(orig);
73810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73811         orig_conv.is_owned = false;
73812         LDKUtxo ret_var = Utxo_clone(&orig_conv);
73813         uint64_t ret_ref = 0;
73814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73816         return ret_ref;
73817 }
73818
73819 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
73820         LDKUtxo o_conv;
73821         o_conv.inner = untag_ptr(o);
73822         o_conv.is_owned = ptr_is_owned(o);
73823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73824         o_conv.is_owned = false;
73825         int64_t ret_conv = Utxo_hash(&o_conv);
73826         return ret_conv;
73827 }
73828
73829 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
73830         LDKUtxo a_conv;
73831         a_conv.inner = untag_ptr(a);
73832         a_conv.is_owned = ptr_is_owned(a);
73833         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73834         a_conv.is_owned = false;
73835         LDKUtxo b_conv;
73836         b_conv.inner = untag_ptr(b);
73837         b_conv.is_owned = ptr_is_owned(b);
73838         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73839         b_conv.is_owned = false;
73840         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
73841         return ret_conv;
73842 }
73843
73844 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
73845         LDKOutPoint outpoint_conv;
73846         outpoint_conv.inner = untag_ptr(outpoint);
73847         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73848         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73849         outpoint_conv = OutPoint_clone(&outpoint_conv);
73850         uint8_t pubkey_hash_arr[20];
73851         CHECK(pubkey_hash->arr_len == 20);
73852         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
73853         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
73854         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
73855         uint64_t ret_ref = 0;
73856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73858         return ret_ref;
73859 }
73860
73861 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
73862         LDKCoinSelection this_obj_conv;
73863         this_obj_conv.inner = untag_ptr(this_obj);
73864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73866         CoinSelection_free(this_obj_conv);
73867 }
73868
73869 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
73870         LDKCoinSelection this_ptr_conv;
73871         this_ptr_conv.inner = untag_ptr(this_ptr);
73872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73874         this_ptr_conv.is_owned = false;
73875         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
73876         uint64_tArray ret_arr = NULL;
73877         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
73878         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
73879         for (size_t g = 0; g < ret_var.datalen; g++) {
73880                 LDKUtxo ret_conv_6_var = ret_var.data[g];
73881                 uint64_t ret_conv_6_ref = 0;
73882                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
73883                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
73884                 ret_arr_ptr[g] = ret_conv_6_ref;
73885         }
73886         
73887         FREE(ret_var.data);
73888         return ret_arr;
73889 }
73890
73891 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
73892         LDKCoinSelection this_ptr_conv;
73893         this_ptr_conv.inner = untag_ptr(this_ptr);
73894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73896         this_ptr_conv.is_owned = false;
73897         LDKCVec_UtxoZ val_constr;
73898         val_constr.datalen = val->arr_len;
73899         if (val_constr.datalen > 0)
73900                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73901         else
73902                 val_constr.data = NULL;
73903         uint64_t* val_vals = val->elems;
73904         for (size_t g = 0; g < val_constr.datalen; g++) {
73905                 uint64_t val_conv_6 = val_vals[g];
73906                 LDKUtxo val_conv_6_conv;
73907                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
73908                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
73909                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
73910                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
73911                 val_constr.data[g] = val_conv_6_conv;
73912         }
73913         FREE(val);
73914         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
73915 }
73916
73917 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
73918         LDKCoinSelection this_ptr_conv;
73919         this_ptr_conv.inner = untag_ptr(this_ptr);
73920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73922         this_ptr_conv.is_owned = false;
73923         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
73924         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
73925         uint64_t ret_ref = tag_ptr(ret_copy, true);
73926         return ret_ref;
73927 }
73928
73929 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
73930         LDKCoinSelection this_ptr_conv;
73931         this_ptr_conv.inner = untag_ptr(this_ptr);
73932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73934         this_ptr_conv.is_owned = false;
73935         void* val_ptr = untag_ptr(val);
73936         CHECK_ACCESS(val_ptr);
73937         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
73938         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
73939         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
73940 }
73941
73942 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
73943         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
73944         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
73945         if (confirmed_utxos_arg_constr.datalen > 0)
73946                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73947         else
73948                 confirmed_utxos_arg_constr.data = NULL;
73949         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
73950         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
73951                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
73952                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
73953                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
73954                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
73955                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
73956                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
73957                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
73958         }
73959         FREE(confirmed_utxos_arg);
73960         void* change_output_arg_ptr = untag_ptr(change_output_arg);
73961         CHECK_ACCESS(change_output_arg_ptr);
73962         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
73963         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
73964         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
73965         uint64_t ret_ref = 0;
73966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73968         return ret_ref;
73969 }
73970
73971 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
73972         LDKCoinSelection ret_var = CoinSelection_clone(arg);
73973         uint64_t ret_ref = 0;
73974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73976         return ret_ref;
73977 }
73978 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
73979         LDKCoinSelection arg_conv;
73980         arg_conv.inner = untag_ptr(arg);
73981         arg_conv.is_owned = ptr_is_owned(arg);
73982         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73983         arg_conv.is_owned = false;
73984         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
73985         return ret_conv;
73986 }
73987
73988 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
73989         LDKCoinSelection orig_conv;
73990         orig_conv.inner = untag_ptr(orig);
73991         orig_conv.is_owned = ptr_is_owned(orig);
73992         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73993         orig_conv.is_owned = false;
73994         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
73995         uint64_t ret_ref = 0;
73996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73998         return ret_ref;
73999 }
74000
74001 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
74002         if (!ptr_is_owned(this_ptr)) return;
74003         void* this_ptr_ptr = untag_ptr(this_ptr);
74004         CHECK_ACCESS(this_ptr_ptr);
74005         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
74006         FREE(untag_ptr(this_ptr));
74007         CoinSelectionSource_free(this_ptr_conv);
74008 }
74009
74010 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
74011         if (!ptr_is_owned(this_ptr)) return;
74012         void* this_ptr_ptr = untag_ptr(this_ptr);
74013         CHECK_ACCESS(this_ptr_ptr);
74014         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
74015         FREE(untag_ptr(this_ptr));
74016         WalletSource_free(this_ptr_conv);
74017 }
74018
74019 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
74020         LDKWallet this_obj_conv;
74021         this_obj_conv.inner = untag_ptr(this_obj);
74022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74024         Wallet_free(this_obj_conv);
74025 }
74026
74027 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
74028         void* source_ptr = untag_ptr(source);
74029         CHECK_ACCESS(source_ptr);
74030         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
74031         if (source_conv.free == LDKWalletSource_JCalls_free) {
74032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74033                 LDKWalletSource_JCalls_cloned(&source_conv);
74034         }
74035         void* logger_ptr = untag_ptr(logger);
74036         CHECK_ACCESS(logger_ptr);
74037         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74038         if (logger_conv.free == LDKLogger_JCalls_free) {
74039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74040                 LDKLogger_JCalls_cloned(&logger_conv);
74041         }
74042         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
74043         uint64_t ret_ref = 0;
74044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74046         return ret_ref;
74047 }
74048
74049 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
74050         LDKWallet this_arg_conv;
74051         this_arg_conv.inner = untag_ptr(this_arg);
74052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74054         this_arg_conv.is_owned = false;
74055         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
74056         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
74057         return tag_ptr(ret_ret, true);
74058 }
74059
74060 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
74061         LDKBumpTransactionEventHandler this_obj_conv;
74062         this_obj_conv.inner = untag_ptr(this_obj);
74063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74065         BumpTransactionEventHandler_free(this_obj_conv);
74066 }
74067
74068 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) {
74069         void* broadcaster_ptr = untag_ptr(broadcaster);
74070         CHECK_ACCESS(broadcaster_ptr);
74071         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
74072         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
74073                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74074                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
74075         }
74076         void* utxo_source_ptr = untag_ptr(utxo_source);
74077         CHECK_ACCESS(utxo_source_ptr);
74078         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
74079         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
74080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74081                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
74082         }
74083         void* signer_provider_ptr = untag_ptr(signer_provider);
74084         CHECK_ACCESS(signer_provider_ptr);
74085         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
74086         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
74087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74088                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
74089         }
74090         void* logger_ptr = untag_ptr(logger);
74091         CHECK_ACCESS(logger_ptr);
74092         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74093         if (logger_conv.free == LDKLogger_JCalls_free) {
74094                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74095                 LDKLogger_JCalls_cloned(&logger_conv);
74096         }
74097         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
74098         uint64_t ret_ref = 0;
74099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74101         return ret_ref;
74102 }
74103
74104 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
74105         LDKBumpTransactionEventHandler this_arg_conv;
74106         this_arg_conv.inner = untag_ptr(this_arg);
74107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74109         this_arg_conv.is_owned = false;
74110         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
74111         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
74112 }
74113
74114 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
74115         if (!ptr_is_owned(this_ptr)) return;
74116         void* this_ptr_ptr = untag_ptr(this_ptr);
74117         CHECK_ACCESS(this_ptr_ptr);
74118         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
74119         FREE(untag_ptr(this_ptr));
74120         GossipSync_free(this_ptr_conv);
74121 }
74122
74123 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
74124         LDKP2PGossipSync a_conv;
74125         a_conv.inner = untag_ptr(a);
74126         a_conv.is_owned = ptr_is_owned(a);
74127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74128         a_conv.is_owned = false;
74129         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74130         *ret_copy = GossipSync_p2_p(&a_conv);
74131         uint64_t ret_ref = tag_ptr(ret_copy, true);
74132         return ret_ref;
74133 }
74134
74135 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
74136         LDKRapidGossipSync a_conv;
74137         a_conv.inner = untag_ptr(a);
74138         a_conv.is_owned = ptr_is_owned(a);
74139         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74140         a_conv.is_owned = false;
74141         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74142         *ret_copy = GossipSync_rapid(&a_conv);
74143         uint64_t ret_ref = tag_ptr(ret_copy, true);
74144         return ret_ref;
74145 }
74146
74147 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
74148         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74149         *ret_copy = GossipSync_none();
74150         uint64_t ret_ref = tag_ptr(ret_copy, true);
74151         return ret_ref;
74152 }
74153
74154 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
74155         if (!ptr_is_owned(this_ptr)) return;
74156         void* this_ptr_ptr = untag_ptr(this_ptr);
74157         CHECK_ACCESS(this_ptr_ptr);
74158         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
74159         FREE(untag_ptr(this_ptr));
74160         GraphSyncError_free(this_ptr_conv);
74161 }
74162
74163 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
74164         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74165         *ret_copy = GraphSyncError_clone(arg);
74166         uint64_t ret_ref = tag_ptr(ret_copy, true);
74167         return ret_ref;
74168 }
74169 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
74170         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
74171         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
74172         return ret_conv;
74173 }
74174
74175 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
74176         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
74177         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74178         *ret_copy = GraphSyncError_clone(orig_conv);
74179         uint64_t ret_ref = tag_ptr(ret_copy, true);
74180         return ret_ref;
74181 }
74182
74183 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
74184         void* a_ptr = untag_ptr(a);
74185         CHECK_ACCESS(a_ptr);
74186         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
74187         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
74188         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74189         *ret_copy = GraphSyncError_decode_error(a_conv);
74190         uint64_t ret_ref = tag_ptr(ret_copy, true);
74191         return ret_ref;
74192 }
74193
74194 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
74195         LDKLightningError a_conv;
74196         a_conv.inner = untag_ptr(a);
74197         a_conv.is_owned = ptr_is_owned(a);
74198         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74199         a_conv = LightningError_clone(&a_conv);
74200         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74201         *ret_copy = GraphSyncError_lightning_error(a_conv);
74202         uint64_t ret_ref = tag_ptr(ret_copy, true);
74203         return ret_ref;
74204 }
74205
74206 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
74207         LDKRapidGossipSync this_obj_conv;
74208         this_obj_conv.inner = untag_ptr(this_obj);
74209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74211         RapidGossipSync_free(this_obj_conv);
74212 }
74213
74214 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
74215         LDKNetworkGraph network_graph_conv;
74216         network_graph_conv.inner = untag_ptr(network_graph);
74217         network_graph_conv.is_owned = ptr_is_owned(network_graph);
74218         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
74219         network_graph_conv.is_owned = false;
74220         void* logger_ptr = untag_ptr(logger);
74221         CHECK_ACCESS(logger_ptr);
74222         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74223         if (logger_conv.free == LDKLogger_JCalls_free) {
74224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74225                 LDKLogger_JCalls_cloned(&logger_conv);
74226         }
74227         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
74228         uint64_t ret_ref = 0;
74229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74231         return ret_ref;
74232 }
74233
74234 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) {
74235         LDKRapidGossipSync this_arg_conv;
74236         this_arg_conv.inner = untag_ptr(this_arg);
74237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74239         this_arg_conv.is_owned = false;
74240         LDKu8slice update_data_ref;
74241         update_data_ref.datalen = update_data->arr_len;
74242         update_data_ref.data = update_data->elems;
74243         void* current_time_unix_ptr = untag_ptr(current_time_unix);
74244         CHECK_ACCESS(current_time_unix_ptr);
74245         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
74246         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
74247         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
74248         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
74249         FREE(update_data);
74250         return tag_ptr(ret_conv, true);
74251 }
74252
74253 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
74254         LDKRapidGossipSync this_arg_conv;
74255         this_arg_conv.inner = untag_ptr(this_arg);
74256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74258         this_arg_conv.is_owned = false;
74259         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
74260         return ret_conv;
74261 }
74262
74263 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
74264         if (!ptr_is_owned(this_ptr)) return;
74265         void* this_ptr_ptr = untag_ptr(this_ptr);
74266         CHECK_ACCESS(this_ptr_ptr);
74267         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
74268         FREE(untag_ptr(this_ptr));
74269         Bolt11ParseError_free(this_ptr_conv);
74270 }
74271
74272 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
74273         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74274         *ret_copy = Bolt11ParseError_clone(arg);
74275         uint64_t ret_ref = tag_ptr(ret_copy, true);
74276         return ret_ref;
74277 }
74278 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
74279         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
74280         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
74281         return ret_conv;
74282 }
74283
74284 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
74285         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
74286         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74287         *ret_copy = Bolt11ParseError_clone(orig_conv);
74288         uint64_t ret_ref = tag_ptr(ret_copy, true);
74289         return ret_ref;
74290 }
74291
74292 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
74293         void* a_ptr = untag_ptr(a);
74294         CHECK_ACCESS(a_ptr);
74295         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
74296         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
74297         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74298         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
74299         uint64_t ret_ref = tag_ptr(ret_copy, true);
74300         return ret_ref;
74301 }
74302
74303 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
74304         
74305         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74306         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
74307         uint64_t ret_ref = tag_ptr(ret_copy, true);
74308         return ret_ref;
74309 }
74310
74311 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
74312         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
74313         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74314         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
74315         uint64_t ret_ref = tag_ptr(ret_copy, true);
74316         return ret_ref;
74317 }
74318
74319 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
74320         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74321         *ret_copy = Bolt11ParseError_bad_prefix();
74322         uint64_t ret_ref = tag_ptr(ret_copy, true);
74323         return ret_ref;
74324 }
74325
74326 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
74327         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74328         *ret_copy = Bolt11ParseError_unknown_currency();
74329         uint64_t ret_ref = tag_ptr(ret_copy, true);
74330         return ret_ref;
74331 }
74332
74333 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
74334         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74335         *ret_copy = Bolt11ParseError_unknown_si_prefix();
74336         uint64_t ret_ref = tag_ptr(ret_copy, true);
74337         return ret_ref;
74338 }
74339
74340 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
74341         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74342         *ret_copy = Bolt11ParseError_malformed_hrp();
74343         uint64_t ret_ref = tag_ptr(ret_copy, true);
74344         return ret_ref;
74345 }
74346
74347 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
74348         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74349         *ret_copy = Bolt11ParseError_too_short_data_part();
74350         uint64_t ret_ref = tag_ptr(ret_copy, true);
74351         return ret_ref;
74352 }
74353
74354 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
74355         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74356         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
74357         uint64_t ret_ref = tag_ptr(ret_copy, true);
74358         return ret_ref;
74359 }
74360
74361 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
74362         
74363         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74364         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
74365         uint64_t ret_ref = tag_ptr(ret_copy, true);
74366         return ret_ref;
74367 }
74368
74369 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
74370         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74371         *ret_copy = Bolt11ParseError_padding_error();
74372         uint64_t ret_ref = tag_ptr(ret_copy, true);
74373         return ret_ref;
74374 }
74375
74376 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
74377         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74378         *ret_copy = Bolt11ParseError_integer_overflow_error();
74379         uint64_t ret_ref = tag_ptr(ret_copy, true);
74380         return ret_ref;
74381 }
74382
74383 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
74384         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74385         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
74386         uint64_t ret_ref = tag_ptr(ret_copy, true);
74387         return ret_ref;
74388 }
74389
74390 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
74391         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74392         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
74393         uint64_t ret_ref = tag_ptr(ret_copy, true);
74394         return ret_ref;
74395 }
74396
74397 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
74398         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74399         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
74400         uint64_t ret_ref = tag_ptr(ret_copy, true);
74401         return ret_ref;
74402 }
74403
74404 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
74405         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74406         *ret_copy = Bolt11ParseError_invalid_recovery_id();
74407         uint64_t ret_ref = tag_ptr(ret_copy, true);
74408         return ret_ref;
74409 }
74410
74411 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
74412         LDKStr a_conv = str_ref_to_owned_c(a);
74413         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74414         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
74415         uint64_t ret_ref = tag_ptr(ret_copy, true);
74416         return ret_ref;
74417 }
74418
74419 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
74420         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74421         *ret_copy = Bolt11ParseError_skip();
74422         uint64_t ret_ref = tag_ptr(ret_copy, true);
74423         return ret_ref;
74424 }
74425
74426 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
74427         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
74428         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
74429         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
74430         return ret_conv;
74431 }
74432
74433 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
74434         if (!ptr_is_owned(this_ptr)) return;
74435         void* this_ptr_ptr = untag_ptr(this_ptr);
74436         CHECK_ACCESS(this_ptr_ptr);
74437         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
74438         FREE(untag_ptr(this_ptr));
74439         ParseOrSemanticError_free(this_ptr_conv);
74440 }
74441
74442 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
74443         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74444         *ret_copy = ParseOrSemanticError_clone(arg);
74445         uint64_t ret_ref = tag_ptr(ret_copy, true);
74446         return ret_ref;
74447 }
74448 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
74449         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
74450         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
74451         return ret_conv;
74452 }
74453
74454 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
74455         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
74456         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74457         *ret_copy = ParseOrSemanticError_clone(orig_conv);
74458         uint64_t ret_ref = tag_ptr(ret_copy, true);
74459         return ret_ref;
74460 }
74461
74462 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
74463         void* a_ptr = untag_ptr(a);
74464         CHECK_ACCESS(a_ptr);
74465         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
74466         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
74467         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74468         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
74469         uint64_t ret_ref = tag_ptr(ret_copy, true);
74470         return ret_ref;
74471 }
74472
74473 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
74474         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
74475         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74476         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
74477         uint64_t ret_ref = tag_ptr(ret_copy, true);
74478         return ret_ref;
74479 }
74480
74481 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
74482         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
74483         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
74484         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
74485         return ret_conv;
74486 }
74487
74488 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
74489         LDKBolt11Invoice this_obj_conv;
74490         this_obj_conv.inner = untag_ptr(this_obj);
74491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74493         Bolt11Invoice_free(this_obj_conv);
74494 }
74495
74496 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
74497         LDKBolt11Invoice a_conv;
74498         a_conv.inner = untag_ptr(a);
74499         a_conv.is_owned = ptr_is_owned(a);
74500         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74501         a_conv.is_owned = false;
74502         LDKBolt11Invoice b_conv;
74503         b_conv.inner = untag_ptr(b);
74504         b_conv.is_owned = ptr_is_owned(b);
74505         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74506         b_conv.is_owned = false;
74507         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
74508         return ret_conv;
74509 }
74510
74511 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
74512         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
74513         uint64_t ret_ref = 0;
74514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74516         return ret_ref;
74517 }
74518 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
74519         LDKBolt11Invoice arg_conv;
74520         arg_conv.inner = untag_ptr(arg);
74521         arg_conv.is_owned = ptr_is_owned(arg);
74522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74523         arg_conv.is_owned = false;
74524         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
74525         return ret_conv;
74526 }
74527
74528 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
74529         LDKBolt11Invoice orig_conv;
74530         orig_conv.inner = untag_ptr(orig);
74531         orig_conv.is_owned = ptr_is_owned(orig);
74532         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74533         orig_conv.is_owned = false;
74534         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
74535         uint64_t ret_ref = 0;
74536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74538         return ret_ref;
74539 }
74540
74541 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
74542         LDKBolt11Invoice o_conv;
74543         o_conv.inner = untag_ptr(o);
74544         o_conv.is_owned = ptr_is_owned(o);
74545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74546         o_conv.is_owned = false;
74547         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
74548         return ret_conv;
74549 }
74550
74551 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
74552         LDKSignedRawBolt11Invoice this_obj_conv;
74553         this_obj_conv.inner = untag_ptr(this_obj);
74554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74556         SignedRawBolt11Invoice_free(this_obj_conv);
74557 }
74558
74559 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
74560         LDKSignedRawBolt11Invoice a_conv;
74561         a_conv.inner = untag_ptr(a);
74562         a_conv.is_owned = ptr_is_owned(a);
74563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74564         a_conv.is_owned = false;
74565         LDKSignedRawBolt11Invoice b_conv;
74566         b_conv.inner = untag_ptr(b);
74567         b_conv.is_owned = ptr_is_owned(b);
74568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74569         b_conv.is_owned = false;
74570         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
74571         return ret_conv;
74572 }
74573
74574 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
74575         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
74576         uint64_t ret_ref = 0;
74577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74579         return ret_ref;
74580 }
74581 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
74582         LDKSignedRawBolt11Invoice arg_conv;
74583         arg_conv.inner = untag_ptr(arg);
74584         arg_conv.is_owned = ptr_is_owned(arg);
74585         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74586         arg_conv.is_owned = false;
74587         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
74588         return ret_conv;
74589 }
74590
74591 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
74592         LDKSignedRawBolt11Invoice orig_conv;
74593         orig_conv.inner = untag_ptr(orig);
74594         orig_conv.is_owned = ptr_is_owned(orig);
74595         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74596         orig_conv.is_owned = false;
74597         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
74598         uint64_t ret_ref = 0;
74599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74601         return ret_ref;
74602 }
74603
74604 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
74605         LDKSignedRawBolt11Invoice o_conv;
74606         o_conv.inner = untag_ptr(o);
74607         o_conv.is_owned = ptr_is_owned(o);
74608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74609         o_conv.is_owned = false;
74610         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
74611         return ret_conv;
74612 }
74613
74614 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
74615         LDKRawBolt11Invoice this_obj_conv;
74616         this_obj_conv.inner = untag_ptr(this_obj);
74617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74619         RawBolt11Invoice_free(this_obj_conv);
74620 }
74621
74622 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
74623         LDKRawBolt11Invoice this_ptr_conv;
74624         this_ptr_conv.inner = untag_ptr(this_ptr);
74625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74627         this_ptr_conv.is_owned = false;
74628         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
74629         uint64_t ret_ref = 0;
74630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74632         return ret_ref;
74633 }
74634
74635 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
74636         LDKRawBolt11Invoice this_ptr_conv;
74637         this_ptr_conv.inner = untag_ptr(this_ptr);
74638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74640         this_ptr_conv.is_owned = false;
74641         LDKRawDataPart val_conv;
74642         val_conv.inner = untag_ptr(val);
74643         val_conv.is_owned = ptr_is_owned(val);
74644         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74645         val_conv = RawDataPart_clone(&val_conv);
74646         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
74647 }
74648
74649 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
74650         LDKRawBolt11Invoice a_conv;
74651         a_conv.inner = untag_ptr(a);
74652         a_conv.is_owned = ptr_is_owned(a);
74653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74654         a_conv.is_owned = false;
74655         LDKRawBolt11Invoice b_conv;
74656         b_conv.inner = untag_ptr(b);
74657         b_conv.is_owned = ptr_is_owned(b);
74658         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74659         b_conv.is_owned = false;
74660         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
74661         return ret_conv;
74662 }
74663
74664 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
74665         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
74666         uint64_t ret_ref = 0;
74667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74669         return ret_ref;
74670 }
74671 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
74672         LDKRawBolt11Invoice arg_conv;
74673         arg_conv.inner = untag_ptr(arg);
74674         arg_conv.is_owned = ptr_is_owned(arg);
74675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74676         arg_conv.is_owned = false;
74677         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
74678         return ret_conv;
74679 }
74680
74681 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
74682         LDKRawBolt11Invoice orig_conv;
74683         orig_conv.inner = untag_ptr(orig);
74684         orig_conv.is_owned = ptr_is_owned(orig);
74685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74686         orig_conv.is_owned = false;
74687         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
74688         uint64_t ret_ref = 0;
74689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74691         return ret_ref;
74692 }
74693
74694 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
74695         LDKRawBolt11Invoice o_conv;
74696         o_conv.inner = untag_ptr(o);
74697         o_conv.is_owned = ptr_is_owned(o);
74698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74699         o_conv.is_owned = false;
74700         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
74701         return ret_conv;
74702 }
74703
74704 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
74705         LDKRawDataPart this_obj_conv;
74706         this_obj_conv.inner = untag_ptr(this_obj);
74707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74709         RawDataPart_free(this_obj_conv);
74710 }
74711
74712 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
74713         LDKRawDataPart this_ptr_conv;
74714         this_ptr_conv.inner = untag_ptr(this_ptr);
74715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74717         this_ptr_conv.is_owned = false;
74718         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
74719         uint64_t ret_ref = 0;
74720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74722         return ret_ref;
74723 }
74724
74725 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
74726         LDKRawDataPart this_ptr_conv;
74727         this_ptr_conv.inner = untag_ptr(this_ptr);
74728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74730         this_ptr_conv.is_owned = false;
74731         LDKPositiveTimestamp val_conv;
74732         val_conv.inner = untag_ptr(val);
74733         val_conv.is_owned = ptr_is_owned(val);
74734         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74735         val_conv = PositiveTimestamp_clone(&val_conv);
74736         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
74737 }
74738
74739 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
74740         LDKRawDataPart a_conv;
74741         a_conv.inner = untag_ptr(a);
74742         a_conv.is_owned = ptr_is_owned(a);
74743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74744         a_conv.is_owned = false;
74745         LDKRawDataPart b_conv;
74746         b_conv.inner = untag_ptr(b);
74747         b_conv.is_owned = ptr_is_owned(b);
74748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74749         b_conv.is_owned = false;
74750         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
74751         return ret_conv;
74752 }
74753
74754 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
74755         LDKRawDataPart ret_var = RawDataPart_clone(arg);
74756         uint64_t ret_ref = 0;
74757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74759         return ret_ref;
74760 }
74761 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
74762         LDKRawDataPart arg_conv;
74763         arg_conv.inner = untag_ptr(arg);
74764         arg_conv.is_owned = ptr_is_owned(arg);
74765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74766         arg_conv.is_owned = false;
74767         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
74768         return ret_conv;
74769 }
74770
74771 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
74772         LDKRawDataPart orig_conv;
74773         orig_conv.inner = untag_ptr(orig);
74774         orig_conv.is_owned = ptr_is_owned(orig);
74775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74776         orig_conv.is_owned = false;
74777         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
74778         uint64_t ret_ref = 0;
74779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74781         return ret_ref;
74782 }
74783
74784 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
74785         LDKRawDataPart o_conv;
74786         o_conv.inner = untag_ptr(o);
74787         o_conv.is_owned = ptr_is_owned(o);
74788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74789         o_conv.is_owned = false;
74790         int64_t ret_conv = RawDataPart_hash(&o_conv);
74791         return ret_conv;
74792 }
74793
74794 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
74795         LDKPositiveTimestamp this_obj_conv;
74796         this_obj_conv.inner = untag_ptr(this_obj);
74797         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74799         PositiveTimestamp_free(this_obj_conv);
74800 }
74801
74802 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
74803         LDKPositiveTimestamp a_conv;
74804         a_conv.inner = untag_ptr(a);
74805         a_conv.is_owned = ptr_is_owned(a);
74806         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74807         a_conv.is_owned = false;
74808         LDKPositiveTimestamp b_conv;
74809         b_conv.inner = untag_ptr(b);
74810         b_conv.is_owned = ptr_is_owned(b);
74811         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74812         b_conv.is_owned = false;
74813         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
74814         return ret_conv;
74815 }
74816
74817 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
74818         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
74819         uint64_t ret_ref = 0;
74820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74822         return ret_ref;
74823 }
74824 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
74825         LDKPositiveTimestamp arg_conv;
74826         arg_conv.inner = untag_ptr(arg);
74827         arg_conv.is_owned = ptr_is_owned(arg);
74828         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74829         arg_conv.is_owned = false;
74830         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
74831         return ret_conv;
74832 }
74833
74834 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
74835         LDKPositiveTimestamp orig_conv;
74836         orig_conv.inner = untag_ptr(orig);
74837         orig_conv.is_owned = ptr_is_owned(orig);
74838         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74839         orig_conv.is_owned = false;
74840         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
74841         uint64_t ret_ref = 0;
74842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74844         return ret_ref;
74845 }
74846
74847 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
74848         LDKPositiveTimestamp o_conv;
74849         o_conv.inner = untag_ptr(o);
74850         o_conv.is_owned = ptr_is_owned(o);
74851         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74852         o_conv.is_owned = false;
74853         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
74854         return ret_conv;
74855 }
74856
74857 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
74858         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
74859         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
74860         return ret_conv;
74861 }
74862
74863 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
74864         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
74865         return ret_conv;
74866 }
74867
74868 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
74869         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
74870         return ret_conv;
74871 }
74872
74873 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
74874         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
74875         return ret_conv;
74876 }
74877
74878 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
74879         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
74880         return ret_conv;
74881 }
74882
74883 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
74884         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
74885         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
74886         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
74887         return ret_conv;
74888 }
74889
74890 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
74891         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
74892         int64_t ret_conv = SiPrefix_hash(o_conv);
74893         return ret_conv;
74894 }
74895
74896 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
74897         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
74898         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
74899         return ret_conv;
74900 }
74901
74902 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
74903         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
74904         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
74905         return ret_conv;
74906 }
74907
74908 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
74909         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
74910         return ret_conv;
74911 }
74912
74913 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
74914         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
74915         return ret_conv;
74916 }
74917
74918 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
74919         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
74920         return ret_conv;
74921 }
74922
74923 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
74924         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
74925         return ret_conv;
74926 }
74927
74928 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
74929         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
74930         return ret_conv;
74931 }
74932
74933 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
74934         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
74935         int64_t ret_conv = Currency_hash(o_conv);
74936         return ret_conv;
74937 }
74938
74939 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
74940         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
74941         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
74942         jboolean ret_conv = Currency_eq(a_conv, b_conv);
74943         return ret_conv;
74944 }
74945
74946 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
74947         LDKSha256 this_obj_conv;
74948         this_obj_conv.inner = untag_ptr(this_obj);
74949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74951         Sha256_free(this_obj_conv);
74952 }
74953
74954 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
74955         LDKSha256 ret_var = Sha256_clone(arg);
74956         uint64_t ret_ref = 0;
74957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74959         return ret_ref;
74960 }
74961 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
74962         LDKSha256 arg_conv;
74963         arg_conv.inner = untag_ptr(arg);
74964         arg_conv.is_owned = ptr_is_owned(arg);
74965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74966         arg_conv.is_owned = false;
74967         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
74968         return ret_conv;
74969 }
74970
74971 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
74972         LDKSha256 orig_conv;
74973         orig_conv.inner = untag_ptr(orig);
74974         orig_conv.is_owned = ptr_is_owned(orig);
74975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74976         orig_conv.is_owned = false;
74977         LDKSha256 ret_var = Sha256_clone(&orig_conv);
74978         uint64_t ret_ref = 0;
74979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74981         return ret_ref;
74982 }
74983
74984 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
74985         LDKSha256 o_conv;
74986         o_conv.inner = untag_ptr(o);
74987         o_conv.is_owned = ptr_is_owned(o);
74988         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74989         o_conv.is_owned = false;
74990         int64_t ret_conv = Sha256_hash(&o_conv);
74991         return ret_conv;
74992 }
74993
74994 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
74995         LDKSha256 a_conv;
74996         a_conv.inner = untag_ptr(a);
74997         a_conv.is_owned = ptr_is_owned(a);
74998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74999         a_conv.is_owned = false;
75000         LDKSha256 b_conv;
75001         b_conv.inner = untag_ptr(b);
75002         b_conv.is_owned = ptr_is_owned(b);
75003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75004         b_conv.is_owned = false;
75005         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
75006         return ret_conv;
75007 }
75008
75009 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
75010         uint8_t bytes_arr[32];
75011         CHECK(bytes->arr_len == 32);
75012         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
75013         uint8_t (*bytes_ref)[32] = &bytes_arr;
75014         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
75015         uint64_t ret_ref = 0;
75016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75018         return ret_ref;
75019 }
75020
75021 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
75022         LDKDescription this_obj_conv;
75023         this_obj_conv.inner = untag_ptr(this_obj);
75024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75026         Description_free(this_obj_conv);
75027 }
75028
75029 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
75030         LDKDescription ret_var = Description_clone(arg);
75031         uint64_t ret_ref = 0;
75032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75034         return ret_ref;
75035 }
75036 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
75037         LDKDescription arg_conv;
75038         arg_conv.inner = untag_ptr(arg);
75039         arg_conv.is_owned = ptr_is_owned(arg);
75040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75041         arg_conv.is_owned = false;
75042         int64_t ret_conv = Description_clone_ptr(&arg_conv);
75043         return ret_conv;
75044 }
75045
75046 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
75047         LDKDescription orig_conv;
75048         orig_conv.inner = untag_ptr(orig);
75049         orig_conv.is_owned = ptr_is_owned(orig);
75050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75051         orig_conv.is_owned = false;
75052         LDKDescription ret_var = Description_clone(&orig_conv);
75053         uint64_t ret_ref = 0;
75054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75056         return ret_ref;
75057 }
75058
75059 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
75060         LDKDescription o_conv;
75061         o_conv.inner = untag_ptr(o);
75062         o_conv.is_owned = ptr_is_owned(o);
75063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75064         o_conv.is_owned = false;
75065         int64_t ret_conv = Description_hash(&o_conv);
75066         return ret_conv;
75067 }
75068
75069 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
75070         LDKDescription a_conv;
75071         a_conv.inner = untag_ptr(a);
75072         a_conv.is_owned = ptr_is_owned(a);
75073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75074         a_conv.is_owned = false;
75075         LDKDescription b_conv;
75076         b_conv.inner = untag_ptr(b);
75077         b_conv.is_owned = ptr_is_owned(b);
75078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75079         b_conv.is_owned = false;
75080         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
75081         return ret_conv;
75082 }
75083
75084 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
75085         LDKPayeePubKey this_obj_conv;
75086         this_obj_conv.inner = untag_ptr(this_obj);
75087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75089         PayeePubKey_free(this_obj_conv);
75090 }
75091
75092 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
75093         LDKPayeePubKey this_ptr_conv;
75094         this_ptr_conv.inner = untag_ptr(this_ptr);
75095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75097         this_ptr_conv.is_owned = false;
75098         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75099         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
75100         return ret_arr;
75101 }
75102
75103 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
75104         LDKPayeePubKey this_ptr_conv;
75105         this_ptr_conv.inner = untag_ptr(this_ptr);
75106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75108         this_ptr_conv.is_owned = false;
75109         LDKPublicKey val_ref;
75110         CHECK(val->arr_len == 33);
75111         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
75112         PayeePubKey_set_a(&this_ptr_conv, val_ref);
75113 }
75114
75115 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
75116         LDKPublicKey a_arg_ref;
75117         CHECK(a_arg->arr_len == 33);
75118         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
75119         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
75120         uint64_t ret_ref = 0;
75121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75123         return ret_ref;
75124 }
75125
75126 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
75127         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
75128         uint64_t ret_ref = 0;
75129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75131         return ret_ref;
75132 }
75133 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
75134         LDKPayeePubKey arg_conv;
75135         arg_conv.inner = untag_ptr(arg);
75136         arg_conv.is_owned = ptr_is_owned(arg);
75137         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75138         arg_conv.is_owned = false;
75139         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
75140         return ret_conv;
75141 }
75142
75143 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
75144         LDKPayeePubKey orig_conv;
75145         orig_conv.inner = untag_ptr(orig);
75146         orig_conv.is_owned = ptr_is_owned(orig);
75147         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75148         orig_conv.is_owned = false;
75149         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
75150         uint64_t ret_ref = 0;
75151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75153         return ret_ref;
75154 }
75155
75156 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
75157         LDKPayeePubKey o_conv;
75158         o_conv.inner = untag_ptr(o);
75159         o_conv.is_owned = ptr_is_owned(o);
75160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75161         o_conv.is_owned = false;
75162         int64_t ret_conv = PayeePubKey_hash(&o_conv);
75163         return ret_conv;
75164 }
75165
75166 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
75167         LDKPayeePubKey a_conv;
75168         a_conv.inner = untag_ptr(a);
75169         a_conv.is_owned = ptr_is_owned(a);
75170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75171         a_conv.is_owned = false;
75172         LDKPayeePubKey b_conv;
75173         b_conv.inner = untag_ptr(b);
75174         b_conv.is_owned = ptr_is_owned(b);
75175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75176         b_conv.is_owned = false;
75177         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
75178         return ret_conv;
75179 }
75180
75181 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
75182         LDKExpiryTime this_obj_conv;
75183         this_obj_conv.inner = untag_ptr(this_obj);
75184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75186         ExpiryTime_free(this_obj_conv);
75187 }
75188
75189 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
75190         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
75191         uint64_t ret_ref = 0;
75192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75194         return ret_ref;
75195 }
75196 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
75197         LDKExpiryTime arg_conv;
75198         arg_conv.inner = untag_ptr(arg);
75199         arg_conv.is_owned = ptr_is_owned(arg);
75200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75201         arg_conv.is_owned = false;
75202         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
75203         return ret_conv;
75204 }
75205
75206 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
75207         LDKExpiryTime orig_conv;
75208         orig_conv.inner = untag_ptr(orig);
75209         orig_conv.is_owned = ptr_is_owned(orig);
75210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75211         orig_conv.is_owned = false;
75212         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
75213         uint64_t ret_ref = 0;
75214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75216         return ret_ref;
75217 }
75218
75219 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
75220         LDKExpiryTime o_conv;
75221         o_conv.inner = untag_ptr(o);
75222         o_conv.is_owned = ptr_is_owned(o);
75223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75224         o_conv.is_owned = false;
75225         int64_t ret_conv = ExpiryTime_hash(&o_conv);
75226         return ret_conv;
75227 }
75228
75229 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
75230         LDKExpiryTime a_conv;
75231         a_conv.inner = untag_ptr(a);
75232         a_conv.is_owned = ptr_is_owned(a);
75233         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75234         a_conv.is_owned = false;
75235         LDKExpiryTime b_conv;
75236         b_conv.inner = untag_ptr(b);
75237         b_conv.is_owned = ptr_is_owned(b);
75238         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75239         b_conv.is_owned = false;
75240         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
75241         return ret_conv;
75242 }
75243
75244 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
75245         LDKMinFinalCltvExpiryDelta this_obj_conv;
75246         this_obj_conv.inner = untag_ptr(this_obj);
75247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75249         MinFinalCltvExpiryDelta_free(this_obj_conv);
75250 }
75251
75252 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
75253         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75254         this_ptr_conv.inner = untag_ptr(this_ptr);
75255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75257         this_ptr_conv.is_owned = false;
75258         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
75259         return ret_conv;
75260 }
75261
75262 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
75263         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75264         this_ptr_conv.inner = untag_ptr(this_ptr);
75265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75267         this_ptr_conv.is_owned = false;
75268         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
75269 }
75270
75271 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
75272         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
75273         uint64_t ret_ref = 0;
75274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75276         return ret_ref;
75277 }
75278
75279 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
75280         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
75281         uint64_t ret_ref = 0;
75282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75284         return ret_ref;
75285 }
75286 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
75287         LDKMinFinalCltvExpiryDelta arg_conv;
75288         arg_conv.inner = untag_ptr(arg);
75289         arg_conv.is_owned = ptr_is_owned(arg);
75290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75291         arg_conv.is_owned = false;
75292         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
75293         return ret_conv;
75294 }
75295
75296 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
75297         LDKMinFinalCltvExpiryDelta orig_conv;
75298         orig_conv.inner = untag_ptr(orig);
75299         orig_conv.is_owned = ptr_is_owned(orig);
75300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75301         orig_conv.is_owned = false;
75302         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
75303         uint64_t ret_ref = 0;
75304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75306         return ret_ref;
75307 }
75308
75309 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
75310         LDKMinFinalCltvExpiryDelta o_conv;
75311         o_conv.inner = untag_ptr(o);
75312         o_conv.is_owned = ptr_is_owned(o);
75313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75314         o_conv.is_owned = false;
75315         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
75316         return ret_conv;
75317 }
75318
75319 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
75320         LDKMinFinalCltvExpiryDelta a_conv;
75321         a_conv.inner = untag_ptr(a);
75322         a_conv.is_owned = ptr_is_owned(a);
75323         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75324         a_conv.is_owned = false;
75325         LDKMinFinalCltvExpiryDelta b_conv;
75326         b_conv.inner = untag_ptr(b);
75327         b_conv.is_owned = ptr_is_owned(b);
75328         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75329         b_conv.is_owned = false;
75330         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
75331         return ret_conv;
75332 }
75333
75334 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
75335         if (!ptr_is_owned(this_ptr)) return;
75336         void* this_ptr_ptr = untag_ptr(this_ptr);
75337         CHECK_ACCESS(this_ptr_ptr);
75338         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
75339         FREE(untag_ptr(this_ptr));
75340         Fallback_free(this_ptr_conv);
75341 }
75342
75343 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
75344         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75345         *ret_copy = Fallback_clone(arg);
75346         uint64_t ret_ref = tag_ptr(ret_copy, true);
75347         return ret_ref;
75348 }
75349 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
75350         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
75351         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
75352         return ret_conv;
75353 }
75354
75355 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
75356         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
75357         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75358         *ret_copy = Fallback_clone(orig_conv);
75359         uint64_t ret_ref = tag_ptr(ret_copy, true);
75360         return ret_ref;
75361 }
75362
75363 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
75364         
75365         LDKCVec_u8Z program_ref;
75366         program_ref.datalen = program->arr_len;
75367         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
75368         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
75369         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75370         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
75371         uint64_t ret_ref = tag_ptr(ret_copy, true);
75372         return ret_ref;
75373 }
75374
75375 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
75376         LDKTwentyBytes a_ref;
75377         CHECK(a->arr_len == 20);
75378         memcpy(a_ref.data, a->elems, 20); FREE(a);
75379         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75380         *ret_copy = Fallback_pub_key_hash(a_ref);
75381         uint64_t ret_ref = tag_ptr(ret_copy, true);
75382         return ret_ref;
75383 }
75384
75385 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
75386         LDKTwentyBytes a_ref;
75387         CHECK(a->arr_len == 20);
75388         memcpy(a_ref.data, a->elems, 20); FREE(a);
75389         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75390         *ret_copy = Fallback_script_hash(a_ref);
75391         uint64_t ret_ref = tag_ptr(ret_copy, true);
75392         return ret_ref;
75393 }
75394
75395 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
75396         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
75397         int64_t ret_conv = Fallback_hash(o_conv);
75398         return ret_conv;
75399 }
75400
75401 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
75402         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
75403         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
75404         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
75405         return ret_conv;
75406 }
75407
75408 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
75409         LDKBolt11InvoiceSignature this_obj_conv;
75410         this_obj_conv.inner = untag_ptr(this_obj);
75411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75413         Bolt11InvoiceSignature_free(this_obj_conv);
75414 }
75415
75416 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
75417         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
75418         uint64_t ret_ref = 0;
75419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75421         return ret_ref;
75422 }
75423 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
75424         LDKBolt11InvoiceSignature arg_conv;
75425         arg_conv.inner = untag_ptr(arg);
75426         arg_conv.is_owned = ptr_is_owned(arg);
75427         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75428         arg_conv.is_owned = false;
75429         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
75430         return ret_conv;
75431 }
75432
75433 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
75434         LDKBolt11InvoiceSignature orig_conv;
75435         orig_conv.inner = untag_ptr(orig);
75436         orig_conv.is_owned = ptr_is_owned(orig);
75437         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75438         orig_conv.is_owned = false;
75439         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
75440         uint64_t ret_ref = 0;
75441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75443         return ret_ref;
75444 }
75445
75446 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
75447         LDKBolt11InvoiceSignature o_conv;
75448         o_conv.inner = untag_ptr(o);
75449         o_conv.is_owned = ptr_is_owned(o);
75450         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75451         o_conv.is_owned = false;
75452         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
75453         return ret_conv;
75454 }
75455
75456 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
75457         LDKBolt11InvoiceSignature a_conv;
75458         a_conv.inner = untag_ptr(a);
75459         a_conv.is_owned = ptr_is_owned(a);
75460         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75461         a_conv.is_owned = false;
75462         LDKBolt11InvoiceSignature b_conv;
75463         b_conv.inner = untag_ptr(b);
75464         b_conv.is_owned = ptr_is_owned(b);
75465         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75466         b_conv.is_owned = false;
75467         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
75468         return ret_conv;
75469 }
75470
75471 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
75472         LDKPrivateRoute this_obj_conv;
75473         this_obj_conv.inner = untag_ptr(this_obj);
75474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75476         PrivateRoute_free(this_obj_conv);
75477 }
75478
75479 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
75480         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
75481         uint64_t ret_ref = 0;
75482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75484         return ret_ref;
75485 }
75486 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
75487         LDKPrivateRoute arg_conv;
75488         arg_conv.inner = untag_ptr(arg);
75489         arg_conv.is_owned = ptr_is_owned(arg);
75490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75491         arg_conv.is_owned = false;
75492         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
75493         return ret_conv;
75494 }
75495
75496 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
75497         LDKPrivateRoute orig_conv;
75498         orig_conv.inner = untag_ptr(orig);
75499         orig_conv.is_owned = ptr_is_owned(orig);
75500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75501         orig_conv.is_owned = false;
75502         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
75503         uint64_t ret_ref = 0;
75504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75506         return ret_ref;
75507 }
75508
75509 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
75510         LDKPrivateRoute o_conv;
75511         o_conv.inner = untag_ptr(o);
75512         o_conv.is_owned = ptr_is_owned(o);
75513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75514         o_conv.is_owned = false;
75515         int64_t ret_conv = PrivateRoute_hash(&o_conv);
75516         return ret_conv;
75517 }
75518
75519 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
75520         LDKPrivateRoute a_conv;
75521         a_conv.inner = untag_ptr(a);
75522         a_conv.is_owned = ptr_is_owned(a);
75523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75524         a_conv.is_owned = false;
75525         LDKPrivateRoute b_conv;
75526         b_conv.inner = untag_ptr(b);
75527         b_conv.is_owned = ptr_is_owned(b);
75528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75529         b_conv.is_owned = false;
75530         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
75531         return ret_conv;
75532 }
75533
75534 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
75535         LDKSignedRawBolt11Invoice this_arg_conv;
75536         this_arg_conv.inner = untag_ptr(this_arg);
75537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75539         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
75540         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
75541         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
75542         return tag_ptr(ret_conv, true);
75543 }
75544
75545 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
75546         LDKSignedRawBolt11Invoice this_arg_conv;
75547         this_arg_conv.inner = untag_ptr(this_arg);
75548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75550         this_arg_conv.is_owned = false;
75551         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
75552         uint64_t ret_ref = 0;
75553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75555         return ret_ref;
75556 }
75557
75558 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
75559         LDKSignedRawBolt11Invoice this_arg_conv;
75560         this_arg_conv.inner = untag_ptr(this_arg);
75561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75563         this_arg_conv.is_owned = false;
75564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75565         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
75566         return ret_arr;
75567 }
75568
75569 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
75570         LDKSignedRawBolt11Invoice this_arg_conv;
75571         this_arg_conv.inner = untag_ptr(this_arg);
75572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75574         this_arg_conv.is_owned = false;
75575         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
75576         uint64_t ret_ref = 0;
75577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75579         return ret_ref;
75580 }
75581
75582 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
75583         LDKSignedRawBolt11Invoice this_arg_conv;
75584         this_arg_conv.inner = untag_ptr(this_arg);
75585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75587         this_arg_conv.is_owned = false;
75588         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
75589         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
75590         return tag_ptr(ret_conv, true);
75591 }
75592
75593 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
75594         LDKSignedRawBolt11Invoice this_arg_conv;
75595         this_arg_conv.inner = untag_ptr(this_arg);
75596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75598         this_arg_conv.is_owned = false;
75599         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
75600         return ret_conv;
75601 }
75602
75603 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
75604         LDKRawBolt11Invoice this_arg_conv;
75605         this_arg_conv.inner = untag_ptr(this_arg);
75606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75608         this_arg_conv.is_owned = false;
75609         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75610         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
75611         return ret_arr;
75612 }
75613
75614 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
75615         LDKRawBolt11Invoice this_arg_conv;
75616         this_arg_conv.inner = untag_ptr(this_arg);
75617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75619         this_arg_conv.is_owned = false;
75620         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
75621         uint64_t ret_ref = 0;
75622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75624         return ret_ref;
75625 }
75626
75627 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
75628         LDKRawBolt11Invoice this_arg_conv;
75629         this_arg_conv.inner = untag_ptr(this_arg);
75630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75632         this_arg_conv.is_owned = false;
75633         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
75634         uint64_t ret_ref = 0;
75635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75637         return ret_ref;
75638 }
75639
75640 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
75641         LDKRawBolt11Invoice this_arg_conv;
75642         this_arg_conv.inner = untag_ptr(this_arg);
75643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75645         this_arg_conv.is_owned = false;
75646         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
75647         uint64_t ret_ref = 0;
75648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75650         return ret_ref;
75651 }
75652
75653 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
75654         LDKRawBolt11Invoice this_arg_conv;
75655         this_arg_conv.inner = untag_ptr(this_arg);
75656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75658         this_arg_conv.is_owned = false;
75659         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
75660         uint64_t ret_ref = 0;
75661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75663         return ret_ref;
75664 }
75665
75666 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
75667         LDKRawBolt11Invoice this_arg_conv;
75668         this_arg_conv.inner = untag_ptr(this_arg);
75669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75671         this_arg_conv.is_owned = false;
75672         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
75673         uint64_t ret_ref = 0;
75674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75676         return ret_ref;
75677 }
75678
75679 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
75680         LDKRawBolt11Invoice this_arg_conv;
75681         this_arg_conv.inner = untag_ptr(this_arg);
75682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75684         this_arg_conv.is_owned = false;
75685         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
75686         uint64_t ret_ref = 0;
75687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75689         return ret_ref;
75690 }
75691
75692 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
75693         LDKRawBolt11Invoice this_arg_conv;
75694         this_arg_conv.inner = untag_ptr(this_arg);
75695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75697         this_arg_conv.is_owned = false;
75698         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
75699         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
75700         uint64_t ret_ref = tag_ptr(ret_copy, true);
75701         return ret_ref;
75702 }
75703
75704 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
75705         LDKRawBolt11Invoice this_arg_conv;
75706         this_arg_conv.inner = untag_ptr(this_arg);
75707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75709         this_arg_conv.is_owned = false;
75710         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75711         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
75712         uint64_t ret_ref = tag_ptr(ret_copy, true);
75713         return ret_ref;
75714 }
75715
75716 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
75717         LDKRawBolt11Invoice this_arg_conv;
75718         this_arg_conv.inner = untag_ptr(this_arg);
75719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75721         this_arg_conv.is_owned = false;
75722         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
75723         uint64_t ret_ref = 0;
75724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75726         return ret_ref;
75727 }
75728
75729 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
75730         LDKRawBolt11Invoice this_arg_conv;
75731         this_arg_conv.inner = untag_ptr(this_arg);
75732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75734         this_arg_conv.is_owned = false;
75735         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
75736         uint64_tArray ret_arr = NULL;
75737         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
75738         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
75739         for (size_t o = 0; o < ret_var.datalen; o++) {
75740                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
75741                 uint64_t ret_conv_14_ref = 0;
75742                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
75743                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
75744                 ret_arr_ptr[o] = ret_conv_14_ref;
75745         }
75746         
75747         FREE(ret_var.data);
75748         return ret_arr;
75749 }
75750
75751 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
75752         LDKRawBolt11Invoice this_arg_conv;
75753         this_arg_conv.inner = untag_ptr(this_arg);
75754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75756         this_arg_conv.is_owned = false;
75757         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75758         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
75759         uint64_t ret_ref = tag_ptr(ret_copy, true);
75760         return ret_ref;
75761 }
75762
75763 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
75764         LDKRawBolt11Invoice this_arg_conv;
75765         this_arg_conv.inner = untag_ptr(this_arg);
75766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75768         this_arg_conv.is_owned = false;
75769         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
75770         return ret_conv;
75771 }
75772
75773 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
75774         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75775         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
75776         return tag_ptr(ret_conv, true);
75777 }
75778
75779 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
75780         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75781         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
75782         return tag_ptr(ret_conv, true);
75783 }
75784
75785 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
75786         LDKPositiveTimestamp this_arg_conv;
75787         this_arg_conv.inner = untag_ptr(this_arg);
75788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75790         this_arg_conv.is_owned = false;
75791         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
75792         return ret_conv;
75793 }
75794
75795 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
75796         LDKPositiveTimestamp this_arg_conv;
75797         this_arg_conv.inner = untag_ptr(this_arg);
75798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75800         this_arg_conv.is_owned = false;
75801         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
75802         return ret_conv;
75803 }
75804
75805 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
75806         LDKBolt11Invoice this_arg_conv;
75807         this_arg_conv.inner = untag_ptr(this_arg);
75808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75810         this_arg_conv.is_owned = false;
75811         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75812         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
75813         return ret_arr;
75814 }
75815
75816 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
75817         LDKBolt11Invoice this_arg_conv;
75818         this_arg_conv.inner = untag_ptr(this_arg);
75819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75821         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
75822         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
75823         uint64_t ret_ref = 0;
75824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75826         return ret_ref;
75827 }
75828
75829 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
75830         LDKBolt11Invoice this_arg_conv;
75831         this_arg_conv.inner = untag_ptr(this_arg);
75832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75834         this_arg_conv.is_owned = false;
75835         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
75836         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
75837         return tag_ptr(ret_conv, true);
75838 }
75839
75840 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
75841         LDKSignedRawBolt11Invoice signed_invoice_conv;
75842         signed_invoice_conv.inner = untag_ptr(signed_invoice);
75843         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
75844         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
75845         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
75846         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
75847         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
75848         return tag_ptr(ret_conv, true);
75849 }
75850
75851 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
75852         LDKBolt11Invoice this_arg_conv;
75853         this_arg_conv.inner = untag_ptr(this_arg);
75854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75856         this_arg_conv.is_owned = false;
75857         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
75858         return ret_conv;
75859 }
75860
75861 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
75862         LDKBolt11Invoice this_arg_conv;
75863         this_arg_conv.inner = untag_ptr(this_arg);
75864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75866         this_arg_conv.is_owned = false;
75867         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75868         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
75869         return ret_arr;
75870 }
75871
75872 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
75873         LDKBolt11Invoice this_arg_conv;
75874         this_arg_conv.inner = untag_ptr(this_arg);
75875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75877         this_arg_conv.is_owned = false;
75878         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75879         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
75880         return ret_arr;
75881 }
75882
75883 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
75884         LDKBolt11Invoice this_arg_conv;
75885         this_arg_conv.inner = untag_ptr(this_arg);
75886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75888         this_arg_conv.is_owned = false;
75889         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75890         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
75891         return ret_arr;
75892 }
75893
75894 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
75895         LDKBolt11Invoice this_arg_conv;
75896         this_arg_conv.inner = untag_ptr(this_arg);
75897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75899         this_arg_conv.is_owned = false;
75900         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75901         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
75902         uint64_t ret_ref = tag_ptr(ret_copy, true);
75903         return ret_ref;
75904 }
75905
75906 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
75907         LDKBolt11Invoice this_arg_conv;
75908         this_arg_conv.inner = untag_ptr(this_arg);
75909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75911         this_arg_conv.is_owned = false;
75912         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
75913         uint64_t ret_ref = 0;
75914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75916         return ret_ref;
75917 }
75918
75919 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
75920         LDKBolt11Invoice this_arg_conv;
75921         this_arg_conv.inner = untag_ptr(this_arg);
75922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75924         this_arg_conv.is_owned = false;
75925         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75926         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
75927         return ret_arr;
75928 }
75929
75930 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
75931         LDKBolt11Invoice this_arg_conv;
75932         this_arg_conv.inner = untag_ptr(this_arg);
75933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75935         this_arg_conv.is_owned = false;
75936         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75937         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
75938         uint64_t ret_ref = tag_ptr(ret_copy, true);
75939         return ret_ref;
75940 }
75941
75942 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
75943         LDKBolt11Invoice this_arg_conv;
75944         this_arg_conv.inner = untag_ptr(this_arg);
75945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75947         this_arg_conv.is_owned = false;
75948         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
75949         return ret_conv;
75950 }
75951
75952 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
75953         LDKBolt11Invoice this_arg_conv;
75954         this_arg_conv.inner = untag_ptr(this_arg);
75955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75957         this_arg_conv.is_owned = false;
75958         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
75959         return ret_conv;
75960 }
75961
75962 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
75963         LDKBolt11Invoice this_arg_conv;
75964         this_arg_conv.inner = untag_ptr(this_arg);
75965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75967         this_arg_conv.is_owned = false;
75968         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
75969         return ret_conv;
75970 }
75971
75972 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
75973         LDKBolt11Invoice this_arg_conv;
75974         this_arg_conv.inner = untag_ptr(this_arg);
75975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75977         this_arg_conv.is_owned = false;
75978         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
75979         return ret_conv;
75980 }
75981
75982 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
75983         LDKBolt11Invoice this_arg_conv;
75984         this_arg_conv.inner = untag_ptr(this_arg);
75985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75987         this_arg_conv.is_owned = false;
75988         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
75989         ptrArray ret_arr = NULL;
75990         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
75991         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
75992         for (size_t i = 0; i < ret_var.datalen; i++) {
75993                 LDKStr ret_conv_8_str = ret_var.data[i];
75994                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
75995                 Str_free(ret_conv_8_str);
75996                 ret_arr_ptr[i] = ret_conv_8_conv;
75997         }
75998         
75999         FREE(ret_var.data);
76000         return ret_arr;
76001 }
76002
76003 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
76004         LDKBolt11Invoice this_arg_conv;
76005         this_arg_conv.inner = untag_ptr(this_arg);
76006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76008         this_arg_conv.is_owned = false;
76009         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
76010         uint64_tArray ret_arr = NULL;
76011         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
76012         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
76013         for (size_t o = 0; o < ret_var.datalen; o++) {
76014                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
76015                 uint64_t ret_conv_14_ref = 0;
76016                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
76017                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
76018                 ret_arr_ptr[o] = ret_conv_14_ref;
76019         }
76020         
76021         FREE(ret_var.data);
76022         return ret_arr;
76023 }
76024
76025 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
76026         LDKBolt11Invoice this_arg_conv;
76027         this_arg_conv.inner = untag_ptr(this_arg);
76028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76030         this_arg_conv.is_owned = false;
76031         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
76032         uint64_tArray ret_arr = NULL;
76033         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
76034         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
76035         for (size_t l = 0; l < ret_var.datalen; l++) {
76036                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
76037                 uint64_t ret_conv_11_ref = 0;
76038                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
76039                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
76040                 ret_arr_ptr[l] = ret_conv_11_ref;
76041         }
76042         
76043         FREE(ret_var.data);
76044         return ret_arr;
76045 }
76046
76047 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
76048         LDKBolt11Invoice this_arg_conv;
76049         this_arg_conv.inner = untag_ptr(this_arg);
76050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76052         this_arg_conv.is_owned = false;
76053         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
76054         return ret_conv;
76055 }
76056
76057 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
76058         LDKBolt11Invoice this_arg_conv;
76059         this_arg_conv.inner = untag_ptr(this_arg);
76060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76062         this_arg_conv.is_owned = false;
76063         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76064         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
76065         uint64_t ret_ref = tag_ptr(ret_copy, true);
76066         return ret_ref;
76067 }
76068
76069 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
76070         LDKStr description_conv = str_ref_to_owned_c(description);
76071         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
76072         *ret_conv = Description_new(description_conv);
76073         return tag_ptr(ret_conv, true);
76074 }
76075
76076 uint64_t  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
76077         LDKDescription this_arg_conv;
76078         this_arg_conv.inner = untag_ptr(this_arg);
76079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76081         this_arg_conv = Description_clone(&this_arg_conv);
76082         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
76083         uint64_t ret_ref = 0;
76084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76086         return ret_ref;
76087 }
76088
76089 jstring  __attribute__((export_name("TS_Description_to_str"))) TS_Description_to_str(uint64_t o) {
76090         LDKDescription o_conv;
76091         o_conv.inner = untag_ptr(o);
76092         o_conv.is_owned = ptr_is_owned(o);
76093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76094         o_conv.is_owned = false;
76095         LDKStr ret_str = Description_to_str(&o_conv);
76096         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76097         Str_free(ret_str);
76098         return ret_conv;
76099 }
76100
76101 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
76102         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
76103         uint64_t ret_ref = 0;
76104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76106         return ret_ref;
76107 }
76108
76109 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
76110         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
76111         uint64_t ret_ref = 0;
76112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76114         return ret_ref;
76115 }
76116
76117 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
76118         LDKExpiryTime this_arg_conv;
76119         this_arg_conv.inner = untag_ptr(this_arg);
76120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76122         this_arg_conv.is_owned = false;
76123         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
76124         return ret_conv;
76125 }
76126
76127 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
76128         LDKExpiryTime this_arg_conv;
76129         this_arg_conv.inner = untag_ptr(this_arg);
76130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76132         this_arg_conv.is_owned = false;
76133         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
76134         return ret_conv;
76135 }
76136
76137 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
76138         LDKRouteHint hops_conv;
76139         hops_conv.inner = untag_ptr(hops);
76140         hops_conv.is_owned = ptr_is_owned(hops);
76141         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
76142         hops_conv = RouteHint_clone(&hops_conv);
76143         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
76144         *ret_conv = PrivateRoute_new(hops_conv);
76145         return tag_ptr(ret_conv, true);
76146 }
76147
76148 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
76149         LDKPrivateRoute this_arg_conv;
76150         this_arg_conv.inner = untag_ptr(this_arg);
76151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76153         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
76154         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
76155         uint64_t ret_ref = 0;
76156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76158         return ret_ref;
76159 }
76160
76161 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
76162         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
76163         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
76164         return ret_conv;
76165 }
76166
76167 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
76168         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
76169         return ret_conv;
76170 }
76171
76172 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
76173         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
76174         return ret_conv;
76175 }
76176
76177 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
76178         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
76179         return ret_conv;
76180 }
76181
76182 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
76183         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
76184         return ret_conv;
76185 }
76186
76187 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
76188         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
76189         return ret_conv;
76190 }
76191
76192 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
76193         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
76194         return ret_conv;
76195 }
76196
76197 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
76198         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
76199         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
76200         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
76201         return ret_conv;
76202 }
76203
76204 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
76205         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
76206         LDKStr ret_str = CreationError_to_str(o_conv);
76207         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76208         Str_free(ret_str);
76209         return ret_conv;
76210 }
76211
76212 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
76213         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
76214         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
76215         return ret_conv;
76216 }
76217
76218 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
76219         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
76220         return ret_conv;
76221 }
76222
76223 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
76224         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
76225         return ret_conv;
76226 }
76227
76228 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
76229         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
76230         return ret_conv;
76231 }
76232
76233 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
76234         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
76235         return ret_conv;
76236 }
76237
76238 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
76239         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
76240         return ret_conv;
76241 }
76242
76243 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
76244         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
76245         return ret_conv;
76246 }
76247
76248 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
76249         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
76250         return ret_conv;
76251 }
76252
76253 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
76254         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
76255         return ret_conv;
76256 }
76257
76258 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
76259         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
76260         return ret_conv;
76261 }
76262
76263 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
76264         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
76265         return ret_conv;
76266 }
76267
76268 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
76269         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
76270         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
76271         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
76272         return ret_conv;
76273 }
76274
76275 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
76276         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
76277         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
76278         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76279         Str_free(ret_str);
76280         return ret_conv;
76281 }
76282
76283 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
76284         if (!ptr_is_owned(this_ptr)) return;
76285         void* this_ptr_ptr = untag_ptr(this_ptr);
76286         CHECK_ACCESS(this_ptr_ptr);
76287         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
76288         FREE(untag_ptr(this_ptr));
76289         SignOrCreationError_free(this_ptr_conv);
76290 }
76291
76292 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
76293         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76294         *ret_copy = SignOrCreationError_clone(arg);
76295         uint64_t ret_ref = tag_ptr(ret_copy, true);
76296         return ret_ref;
76297 }
76298 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
76299         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
76300         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
76301         return ret_conv;
76302 }
76303
76304 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
76305         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
76306         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76307         *ret_copy = SignOrCreationError_clone(orig_conv);
76308         uint64_t ret_ref = tag_ptr(ret_copy, true);
76309         return ret_ref;
76310 }
76311
76312 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
76313         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76314         *ret_copy = SignOrCreationError_sign_error();
76315         uint64_t ret_ref = tag_ptr(ret_copy, true);
76316         return ret_ref;
76317 }
76318
76319 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
76320         LDKCreationError a_conv = LDKCreationError_from_js(a);
76321         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76322         *ret_copy = SignOrCreationError_creation_error(a_conv);
76323         uint64_t ret_ref = tag_ptr(ret_copy, true);
76324         return ret_ref;
76325 }
76326
76327 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
76328         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
76329         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
76330         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
76331         return ret_conv;
76332 }
76333
76334 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
76335         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
76336         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
76337         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76338         Str_free(ret_str);
76339         return ret_conv;
76340 }
76341
76342 uint64_t  __attribute__((export_name("TS_payment_parameters_from_zero_amount_invoice"))) TS_payment_parameters_from_zero_amount_invoice(uint64_t invoice, int64_t amount_msat) {
76343         LDKBolt11Invoice invoice_conv;
76344         invoice_conv.inner = untag_ptr(invoice);
76345         invoice_conv.is_owned = ptr_is_owned(invoice);
76346         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76347         invoice_conv.is_owned = false;
76348         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76349         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
76350         return tag_ptr(ret_conv, true);
76351 }
76352
76353 uint64_t  __attribute__((export_name("TS_payment_parameters_from_invoice"))) TS_payment_parameters_from_invoice(uint64_t invoice) {
76354         LDKBolt11Invoice invoice_conv;
76355         invoice_conv.inner = untag_ptr(invoice);
76356         invoice_conv.is_owned = ptr_is_owned(invoice);
76357         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76358         invoice_conv.is_owned = false;
76359         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76360         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
76361         return tag_ptr(ret_conv, true);
76362 }
76363
76364 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) {
76365         void* amt_msat_ptr = untag_ptr(amt_msat);
76366         CHECK_ACCESS(amt_msat_ptr);
76367         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76368         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76369         void* payment_hash_ptr = untag_ptr(payment_hash);
76370         CHECK_ACCESS(payment_hash_ptr);
76371         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76372         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76373         LDKStr description_conv = str_ref_to_owned_c(description);
76374         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76375         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76376         if (phantom_route_hints_constr.datalen > 0)
76377                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76378         else
76379                 phantom_route_hints_constr.data = NULL;
76380         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76381         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76382                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76383                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76384                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76385                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76386                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76387                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76388                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76389         }
76390         FREE(phantom_route_hints);
76391         void* entropy_source_ptr = untag_ptr(entropy_source);
76392         CHECK_ACCESS(entropy_source_ptr);
76393         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76394         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76396                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76397         }
76398         void* node_signer_ptr = untag_ptr(node_signer);
76399         CHECK_ACCESS(node_signer_ptr);
76400         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76401         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76403                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76404         }
76405         void* logger_ptr = untag_ptr(logger);
76406         CHECK_ACCESS(logger_ptr);
76407         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76408         if (logger_conv.free == LDKLogger_JCalls_free) {
76409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76410                 LDKLogger_JCalls_cloned(&logger_conv);
76411         }
76412         LDKCurrency network_conv = LDKCurrency_from_js(network);
76413         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76414         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76415         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76416         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76417         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76418         *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);
76419         return tag_ptr(ret_conv, true);
76420 }
76421
76422 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) {
76423         void* amt_msat_ptr = untag_ptr(amt_msat);
76424         CHECK_ACCESS(amt_msat_ptr);
76425         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76426         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76427         void* payment_hash_ptr = untag_ptr(payment_hash);
76428         CHECK_ACCESS(payment_hash_ptr);
76429         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76430         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76431         LDKSha256 description_hash_conv;
76432         description_hash_conv.inner = untag_ptr(description_hash);
76433         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76434         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76435         description_hash_conv = Sha256_clone(&description_hash_conv);
76436         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76437         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76438         if (phantom_route_hints_constr.datalen > 0)
76439                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76440         else
76441                 phantom_route_hints_constr.data = NULL;
76442         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76443         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76444                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76445                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76446                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76447                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76448                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76449                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76450                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76451         }
76452         FREE(phantom_route_hints);
76453         void* entropy_source_ptr = untag_ptr(entropy_source);
76454         CHECK_ACCESS(entropy_source_ptr);
76455         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76456         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76457                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76458                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76459         }
76460         void* node_signer_ptr = untag_ptr(node_signer);
76461         CHECK_ACCESS(node_signer_ptr);
76462         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76463         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76464                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76465                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76466         }
76467         void* logger_ptr = untag_ptr(logger);
76468         CHECK_ACCESS(logger_ptr);
76469         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76470         if (logger_conv.free == LDKLogger_JCalls_free) {
76471                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76472                 LDKLogger_JCalls_cloned(&logger_conv);
76473         }
76474         LDKCurrency network_conv = LDKCurrency_from_js(network);
76475         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76476         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76477         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76478         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76479         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76480         *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);
76481         return tag_ptr(ret_conv, true);
76482 }
76483
76484 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) {
76485         LDKChannelManager channelmanager_conv;
76486         channelmanager_conv.inner = untag_ptr(channelmanager);
76487         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76488         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76489         channelmanager_conv.is_owned = false;
76490         void* node_signer_ptr = untag_ptr(node_signer);
76491         CHECK_ACCESS(node_signer_ptr);
76492         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76493         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76494                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76495                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76496         }
76497         void* logger_ptr = untag_ptr(logger);
76498         CHECK_ACCESS(logger_ptr);
76499         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76500         if (logger_conv.free == LDKLogger_JCalls_free) {
76501                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76502                 LDKLogger_JCalls_cloned(&logger_conv);
76503         }
76504         LDKCurrency network_conv = LDKCurrency_from_js(network);
76505         void* amt_msat_ptr = untag_ptr(amt_msat);
76506         CHECK_ACCESS(amt_msat_ptr);
76507         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76508         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76509         LDKSha256 description_hash_conv;
76510         description_hash_conv.inner = untag_ptr(description_hash);
76511         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76512         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76513         description_hash_conv = Sha256_clone(&description_hash_conv);
76514         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76515         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76516         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76517         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76518         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76519         *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);
76520         return tag_ptr(ret_conv, true);
76521 }
76522
76523 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) {
76524         LDKChannelManager channelmanager_conv;
76525         channelmanager_conv.inner = untag_ptr(channelmanager);
76526         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76527         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76528         channelmanager_conv.is_owned = false;
76529         void* node_signer_ptr = untag_ptr(node_signer);
76530         CHECK_ACCESS(node_signer_ptr);
76531         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76532         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76533                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76534                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76535         }
76536         void* logger_ptr = untag_ptr(logger);
76537         CHECK_ACCESS(logger_ptr);
76538         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76539         if (logger_conv.free == LDKLogger_JCalls_free) {
76540                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76541                 LDKLogger_JCalls_cloned(&logger_conv);
76542         }
76543         LDKCurrency network_conv = LDKCurrency_from_js(network);
76544         void* amt_msat_ptr = untag_ptr(amt_msat);
76545         CHECK_ACCESS(amt_msat_ptr);
76546         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76547         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76548         LDKStr description_conv = str_ref_to_owned_c(description);
76549         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76550         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76551         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76552         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76553         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76554         *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);
76555         return tag_ptr(ret_conv, true);
76556 }
76557
76558 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) {
76559         LDKChannelManager channelmanager_conv;
76560         channelmanager_conv.inner = untag_ptr(channelmanager);
76561         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76562         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76563         channelmanager_conv.is_owned = false;
76564         void* node_signer_ptr = untag_ptr(node_signer);
76565         CHECK_ACCESS(node_signer_ptr);
76566         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76567         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76569                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76570         }
76571         void* logger_ptr = untag_ptr(logger);
76572         CHECK_ACCESS(logger_ptr);
76573         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76574         if (logger_conv.free == LDKLogger_JCalls_free) {
76575                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76576                 LDKLogger_JCalls_cloned(&logger_conv);
76577         }
76578         LDKCurrency network_conv = LDKCurrency_from_js(network);
76579         void* amt_msat_ptr = untag_ptr(amt_msat);
76580         CHECK_ACCESS(amt_msat_ptr);
76581         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76582         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76583         LDKStr description_conv = str_ref_to_owned_c(description);
76584         LDKThirtyTwoBytes payment_hash_ref;
76585         CHECK(payment_hash->arr_len == 32);
76586         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
76587         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76588         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76589         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76590         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76591         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76592         *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);
76593         return tag_ptr(ret_conv, true);
76594 }
76595
76596 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
76597         LDKStr s_conv = str_ref_to_owned_c(s);
76598         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
76599         *ret_conv = SiPrefix_from_str(s_conv);
76600         return tag_ptr(ret_conv, true);
76601 }
76602
76603 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
76604         LDKStr s_conv = str_ref_to_owned_c(s);
76605         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
76606         *ret_conv = Bolt11Invoice_from_str(s_conv);
76607         return tag_ptr(ret_conv, true);
76608 }
76609
76610 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
76611         LDKStr s_conv = str_ref_to_owned_c(s);
76612         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
76613         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
76614         return tag_ptr(ret_conv, true);
76615 }
76616
76617 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
76618         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
76619         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
76620         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76621         Str_free(ret_str);
76622         return ret_conv;
76623 }
76624
76625 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
76626         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
76627         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
76628         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76629         Str_free(ret_str);
76630         return ret_conv;
76631 }
76632
76633 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
76634         LDKBolt11Invoice o_conv;
76635         o_conv.inner = untag_ptr(o);
76636         o_conv.is_owned = ptr_is_owned(o);
76637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76638         o_conv.is_owned = false;
76639         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
76640         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76641         Str_free(ret_str);
76642         return ret_conv;
76643 }
76644
76645 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
76646         LDKSignedRawBolt11Invoice o_conv;
76647         o_conv.inner = untag_ptr(o);
76648         o_conv.is_owned = ptr_is_owned(o);
76649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76650         o_conv.is_owned = false;
76651         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
76652         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76653         Str_free(ret_str);
76654         return ret_conv;
76655 }
76656
76657 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
76658         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
76659         LDKStr ret_str = Currency_to_str(o_conv);
76660         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76661         Str_free(ret_str);
76662         return ret_conv;
76663 }
76664
76665 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
76666         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
76667         LDKStr ret_str = SiPrefix_to_str(o_conv);
76668         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76669         Str_free(ret_str);
76670         return ret_conv;
76671 }
76672